This is driving me crazy.. . ok I have a code using lightbox.js which is very cool and basically imports a page into a div with a grey.bg cool.. This work fine.. It import the page into a DIV .. Not the problem I have is I wish to contorl a div within that div.. <div id="dk"> </div> <script language="JavaScript"> document.getElementById("dk").innerHTML ="<div id=area2>ddddddl</div>"; function clik(){ document.getElementById("area2").innerHTML ="GOOD BYE"; } </script> <a href="#" onClick="clik();">dkdkd</a> Code (markup): As you know or can see it doesn't work.. But is there any work around ? Thanks
The problem is that document.getElementById("dk").innerHTML ="<div id=area2>ddddddl</div>"; Code (markup): is not getting executed and therefor not visible. <script language="JavaScript"> function loadDiv() { document.getElementById("dk").innerHTML ="<div id=area2>ddddddl</div>"; } function clik(){ document.getElementById("area2").innerHTML ="GOOD BYE"; } </script> <div id="dk"></div> <body onload="loadDiv()"> <a href="#" onClick="clik();">dkdkd</a> </body> Code (markup): That might be what you're looking for.