Jump to content

OnClick Function Help


Spixxx

Recommended Posts

Ok, here's the deal:

I have a dropdown that has the values No(selected) and Yes
I want to have an invisible dropdown that will show if the user selects Yes above, and dissapear if they change it back to know.

Things to know:

My form name is "file_editor"
My Yes/No dropdown name is "is_backup"
My function for this is called "showSelect"

Thanks for all help!!
Link to comment
Share on other sites

Modify as needed:

[code]
<script>
    function showDiv(a) {
        if (a.selectedIndex == 0) {
            document.getElementById('hiddendiv').style.display = "none";
        } else {
            document.getElementById('hiddendiv').style.display = "block";
        }
    }
</script>

<select onchange="showDiv(this)" name="select1">
    <option selected value="y">Yes</option>
    <option value="n">No</option>
</select>

<div id="hiddendiv" style="display: none;">
<select name="select2" id="select2">
    <option selected value="0">0</option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
</select>
</div>[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.