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>

<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>

<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?

no no...same DOMAIN...are they from the same hostname? are they both at http://www.somesite.com for instance? the answer is yes in that case. if not, and one page is from some other host, then no, you can't (it's a security thing)

no no...same DOMAIN...are they from the same hostname? are they both at http://www.somesite.com for instance? the answer is yes in that case. if not, and one page is from some other host, then no, you can't (it's a security thing)

 

yes both are on the same domain and directory

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.