Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding a txt box when certain dropdown is selected
    text
    copied!<p>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. </p> <pre><code>&lt;style&gt; #color {display:none;} &lt;/style&gt; &lt;script&gt; (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 &amp;&amp; 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); &lt;/script&gt; </code></pre> <p>This is the javascript function and below is the html code</p> <pre><code>&lt;tr&gt; &lt;td height="22" class="bodytxt" id="color"&gt; &lt;font size="2" face="Geneva, Arial, Helvetica, sans-serif"&gt;Date of Birth &lt;/font&gt; &lt;/td&gt; &lt;td height="22" class="bodytxt" id="color"&gt; &lt;input type="text" size="20" name="color" value="&lt;?=$_REQUEST['dob']?&gt;" /&gt; &lt;/td&gt;&lt;/tr&gt; </code></pre> <p>the problem i m facing can be seen here live....</p> <p><a href="http://www.sunno.com/medical/clients/test.html" rel="nofollow">http://www.sunno.com/medical/clients/test.html</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload