narjis Posted May 26, 2011 Share Posted May 26, 2011 In the followinfg code I want to show second drop down list when a choice is selected from the first drop down list. Ca'nt find what the problem is. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript"> function showSecond(str) { var xmlHttp ; if(window.XMLHttpRequest) { xmlHttp = new XMLHttpRequest(); } else { xmlHttp= new ActivXObject("Microsoft.XMLHTTP"); } if(xmlHttp.readystate==0 && xmlHttp==200){ document.getElementById("second").innerHTML = xmlHttp.responseText; } xmlHttp.open("GET", "showCity.php?q="+str,true); xmlHttp.send(); } </script> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Showing Cities</title> </head> <body> <form> Select the country <select name ="country" onchange=showSecond(this.value)> <option value="Pakistan">Pakistan</option> <option value="Iran">Iran</option> <option value="India">India</option> <option value="England">England</option> </select> <p> <span id="second"> </span></p> </form> </body> </html> </body> </html> Link to comment https://forums.phpfreaks.com/topic/237491-please-help/ Share on other sites More sharing options...
fugix Posted May 26, 2011 Share Posted May 26, 2011 what are your results? Link to comment https://forums.phpfreaks.com/topic/237491-please-help/#findComment-1220384 Share on other sites More sharing options...
narjis Posted May 26, 2011 Author Share Posted May 26, 2011 It is not showing my second drop down list. Link to comment https://forums.phpfreaks.com/topic/237491-please-help/#findComment-1220394 Share on other sites More sharing options...
play_ Posted May 26, 2011 Share Posted May 26, 2011 This should be in the javascript forum. Also, use jQuery. Link to comment https://forums.phpfreaks.com/topic/237491-please-help/#findComment-1220397 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.