javascript - Dynamically adding HTML using .innerHTML (formatting issue in IE7) -
i have select dropdown when updated takes new variable , dynamically updates div straight below it.
here select input:
<select name='region_name' onchange='showdistrict(this.value)'>
here javascript controls dynamic stuff:
<script> function showdistrict(str) { if (str=="") { document.getelementbyid("district_div").innerhtml=""; return; } if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { document.getelementbyid("district_div").innerhtml=xmlhttp.responsetext; } } xmlhttp.open("get","getdistrict.php?q="+str,true); xmlhttp.send(); } </script>
the page getdistrict.php?q= mysql phone call , loops out info div "district_div" my problem is... div part not stretch correctly in ie 7. dynamic info overlays below it.
when @ source firebug don't see new html innerhtml not sure css issue or having .innerhtml
do not set width
or height
div, or set min-width min-height
, , can set overflow:hidden
div
javascript html css input innerhtml
No comments:
Post a Comment