Welcome Guest, Not a member yet? Register   Sign In
show hide on select
#1

[eluser]egoslip[/eluser]
Hey guys i have very little knowlege of javascript so please bare with me on this

What i want to accomplish is have a drop down field and when they select it it would show the relevant div and hide the other div if they changed there selection before.

This is what I have so far it shows the div but if i change the value on the select it still shows the old div as well.
Code:
[removed]
            function showhide(divid){
                thediv = document.getElementById(divid);
                if(thediv.style.display== 'none' ){
                    thediv.style.display='block'
                }else{
                    thediv.style.display='none'
                }
            }
        [removed]
        
        <br>
        
        Select
        <br>
        <select name='paymethod'>
            <option value='Choose'>Choose</option>
            <option value='Paypal' >Paypal</option>
            <option value='Check'>Check</option>
        </select>
        
        <br>
        
        <div id='Paypal' style="display:none;">
      paypal: email &lt;input type="text" name="paypal_email" value="[email protected]"/&gt;
        </div>
        
        <div id='Check' style="display:none;">
       address: &lt;input name="address" type="text" /&gt;

        </div>

also how can i show the selected optins div when the page loads so they dont have to reselect the optin to change the values.

any help would be great as java scripting is something im lacking


Messages In This Thread
show hide on select - by El Forum - 07-19-2009, 09:28 PM
show hide on select - by El Forum - 07-19-2009, 09:49 PM
show hide on select - by El Forum - 07-19-2009, 09:55 PM
show hide on select - by El Forum - 07-19-2009, 09:57 PM
show hide on select - by El Forum - 07-19-2009, 10:10 PM
show hide on select - by El Forum - 07-19-2009, 10:18 PM
show hide on select - by El Forum - 07-19-2009, 10:23 PM
show hide on select - by El Forum - 07-20-2009, 12:20 AM
show hide on select - by El Forum - 07-20-2009, 01:08 AM
show hide on select - by El Forum - 07-20-2009, 01:40 AM



Theme © iAndrew 2016 - Forum software by © MyBB