codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  How to replace the div content onclick?  siva1117 at 19:46 on Saturday, August 09, 2008
 

Here is my script..
This works perfectly if the call the variable $ssk in the html, but it is not working when i call the variable $cvb.

Please help me out...

<!-- php code start -->
<?

$cvb='<div id="flashcontent">
<script type="text/javascript">
var so = new SWFObject("/forum/player.swf", "sree", "635", "240", "9", "#E7E7E7");
so.addVariable("p_list", "/forum/try.xml");
so.addParam("allowFullScreen", "true");
so.write("flashcontent");
</script>
</div> ';

$ssk='SREE';

?>
<!-- php code end -->


<html>
<head>
<script type="text/javascript" src="/forum/swfobject.js"></script>
<title>Change div content</title>

<style>
/* this is just to add color and look :-)*/
div, a { padding:3px; margin:3px 3px 33px 3px; }
#scriptVars1 { border:1px solid red; width:635px; height:240px; background-color:#EEE;}
</style>

<script>
function changeDivContent( nameOfDiv, newContent )
{
var div = document.getElementById( nameOfDiv );
if( div )
{
div.innerHTML = newContent;
}
}
</script>

</head>
<body>
<a href="#" onclick="changeDivContent( 'scriptVars1', '<? echo $ssk; ?>' )">Click here to change the content</a>

<div id="scriptVars1">
<br/><br/><br/><br/>
This content should be replaced...
</div>

</body>
</html>


Any help from this forum would be really appreciated.








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  ridding of beginning/ending spacebars in each element of a list.
•  Excel to XML
•  DHTML tutorials?
•  The Ballarat Airline Company (BAC)
•  Re: Problem to declare global variable in Object oriented perl
•  Issue with Javascript between web servers
•  Not Allowing Copying from Site
•  Re: dereferenceing a string to a constant name
•  Scrolling Javascript Product Slider


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2008