Hey Guys
I'm trying to display my text through lightbox using getElementbyid().innerHTML for which i'm passing variable from php
It is working absolutely fine in Firefox, Opera, and IE. But when I open it in Chrome and Safari, my text gets displayed for a second and then disappear or do not get displayed at all.
Below is my Javascript
Below is the code through which i'm passing php variable to JS function,Code:function openLightBox(imgsrc, xx){ document.getElementById('light').style.display='block'; document.getElementById('fade').style.display='block'; document.getElementById('light-image').src = imgsrc; showUser(xx); } function closeLightBox(){ //document.getElementById('light-image').innerHTML = ''; document.getElementById('light').style.display='none'; document.getElementById('fade').style.display='none'; } function showUser(str) { if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("div1").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","form2.php?q="+str,true); xmlhttp.send(); }
I know there is no problem with my script as it is working fine in rest of the browsers (except Chrome and Safari).Code:<a onClick="openLightBox('images/<?php echo $imgsrc ?>', '<?php echo $text ?>');" class="enlarge"><img src='images/<?php echo $imgsrc ?>' width="150" height="150" /></a>;
Can anyone please help. Thanks in advance!!!!!



Reply With Quote

Bookmarks