Jump to content

[SOLVED] hiding DIV till option in selectbox is selected


acctman

Recommended Posts

hi i'm using this code below to display an alert when a use select an item from the selectbox. I also need to be able to hide a div until a use selects an item from the box.

 

<script language="javascript">
function changeBack(form){
  for (var i = 0; i < form.folder.options.length; i++) {
    if (form.folder.options[i].selected){
      alert("Photo will be saved too " + form.folder.options[i].text + ".");
    }
  }
}
</script>

Link to comment
Share on other sites

<script language="javascript">
function changeBack(form){
  for (var i = 0; i < form.folder.options.length; i++) {
    if (form.folder.options[i].selected){
      alert("Photo will be saved too " + form.folder.options[i].text + ".");
      document.getElementById('some_div').style.display = 'block';
    }
  }
}
</script>
<div id="some_div" style="display:none;">Here is the contents</div>

Link to comment
Share on other sites

<script language="javascript">
function changeBack(form){
  for (var i = 0; i < form.folder.options.length; i++) {
    if (form.folder.options[i].selected){
      alert("Photo will be saved too " + form.folder.options[i].text + ".");
      document.getElementById('some_div').style.display = 'block';
    }
  }
}
</script>
<div id="some_div" style="display:none;">Here is the contents</div>

 

i have another question related to this. my select boxes are on another page via iframe and the div i want to show/hide is on the main page. is it possible to use contentWindow to access the ID on the other page?

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.