Jump to content

[SOLVED] hide / show with drop down


M.O.S. Studios

Recommended Posts

here is a start for you

javascript

function showBoxes(value){
    
    if(value==1){
        //show  boxes 1 and 2
    }else if(value==2){
       //show box 3
    }
}

 

html

<select onchange="showBoxes(this.value)">
    <option value="1">1</option>
    <option value="2">2</option>
</select>

i got it this is the code

 

 

<body onLoad="document.getElementById('ship_zip').style.display='none';">

<script type="text/javascript">


function ChangeDropdowns(value){
if(value=="U.S.A."){
document.getElementById('ship_post1').style.display='none';
document.getElementById('ship_post2').style.display='none';
document.getElementById('ship_zip').style.display='block';
}else{
document.getElementById('ship_post1').style.display='block';
document.getElementById('ship_post2').style.display='block';
document.getElementById('ship_zip').style.display='none';
}
}
</script>

<form>
<select id="abonnement" name="abonnement" onchange="ChangeDropdowns(this.value);">
    <option value="Canada">Canada</option>
    <option value="U.S.A.">U.S.A.</option>
</select>
<input type=text id="ship_post1" name="ship_post1" value="1">
<input type=text id="ship_post2" name="ship_post2" value="2">
<input type=text id="ship_zip" name="ship_zip">
</form>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.