Adding a txt box when certain dropdown is selected

johnathanrat

New Member
I am having a problem in the script. When i select Canada from drop down list it is supposed to add a text box but it is not adding anything. \[code\]<style> #color {display:none;} </style> <script> (function(d){ var options={ val:'Canada', sel_id:'country', hid_id:'color' }; var browser={ modern:function(){ var method=null; if(d.addEventListener) { method=['DOMContentLoaded',true]; } else if(d.attachEvent) { method=['readystatechange',false]; } return(method); }, addEvent:function(elem,event,func){ if(this.modern()[1]) { elem.addEventListener(event,func,false); } else { elem.attachEvent('on'+event,func); } } }; var load=browser.modern()[0]; var modern=browser.modern()[1]; var init=function(){ if((!modern && d.readyState=='complete') || modern) { var select=d.getElementById(options.sel_id); var input=d.getElementById(options.hid_id); browser.addEvent(select,'change',function(){ var val=this.value; var display=(val==options.val) ? 'block' : 'none'; input.style.display=display; }); } }; browser.addEvent(d,load,init); })(document); </script>\[/code\]This is the javascript function and below is the html code\[code\]<tr> <td height="22" class="bodytxt" id="color"> <font size="2" face="Geneva, Arial, Helvetica, sans-serif">Date of Birth </font> </td> <td height="22" class="bodytxt" id="color"> <input type="text" size="20" name="color" value="http://stackoverflow.com/questions/13786750/<?=$_REQUEST['dob']?>" /></td></tr>\[/code\]the problem i m facing can be seen here live....http://www.sunno.com/medical/clients/test.html
 
Back
Top