I have an onclick event that calls a Javascript function with calls a PHP page. The PHP page dynamically creates the content in a DIV the original onclick event triggered. Inside this dynamically created DIV a have another Javascript function, but it does no execute as I would expect.
HTML
JavascriptCode:echo "<div onClick=\"ajaxpage('moreContent.php?id=$row[id]', div$row[id]');\">";
Inside the PHP the above Javascript calls (this bit doesn't load)...Code:function ajaxpage(url, containerId) { var page_request = false if (window.XMLHttpRequest) // if Mozilla, Safari etc page_request = new XMLHttpRequest() else if (window.ActiveXObject){ // if IE try { page_request = new ActiveXObject("Msxml2.XMLHTTP") } catch (e){ try{ page_request = new ActiveXObject("Microsoft.XMLHTTP") } catch (e){} } } else return false page_request.onreadystatechange=function() { loadpage(page_request, containerId) } page_request.open('GET', url, true) page_request.send(null) var dv = document.getElementById(containerId); dv.style.display = (dv.style.display == 'block' ? 'none' : 'block'); }
How do I get this Javascript to load?Code:echo "<div class=\"userData\">"; echo "<table class=\"grid\" cellspacing=1 id=\"userGrid\">??</table>"; echo "<script type=\"text/javascript\">setup();</script>"; echo "</div>";



Reply With Quote

Bookmarks