dreamwest Posted March 27, 2010 Share Posted March 27, 2010 I need to set an option to direct the php script to the right table of the database based a div id <script> var xmlhttp function showHint(str) { if (str.length==0) { document.getElementById("movie").innerHTML=""; return; } xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Your browser does not support XMLHTTP!"); return; } var url="2.php"; url=url+"?"+str; xmlhttp.onreadystatechange=stateChanged; xmlhttp.open("GET",url,true); xmlhttp.send(null); } function stateChanged() { if (xmlhttp.readyState==4) { document.getElementById("movie").innerHTML=xmlhttp.responseText; } } function GetXmlHttpObject() { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari return new XMLHttpRequest(); } if (window.ActiveXObject) { // code for IE6, IE5 return new ActiveXObject("Microsoft.XMLHTTP"); } return null; }</script> <div style='position:absolute; top:25px; left:0px;' id="movie"></div> Basically i need to add a type to this line based on the div name : so if the div id is movie: <div style='position:absolute; top:25px; left:0px;' id="movie"></div> The javascript will look like this: var url="2.php"; url=url+"?type=movie"+str; OR if the div id is tv: <div style='position:absolute; top:25px; left:0px;' id="tv"></div> The javascript will look like this: var url="2.php"; url=url+"?type=tv"+str; Quote Link to comment https://forums.phpfreaks.com/topic/196687-alter-this-javascript/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.