Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Feb 2010
    Posts
    50
    Thanks
    5
    Thanked 1 Time in 1 Post

    dropdown box show div

    hi every one i have searched the internet and tried many methods but i can get any of them to work
    what i want to do is:
    when completed is selected in a drop down box it shows a div tag
    i have this currently but it is not working
    Code:
    <script>
    function showDiv(value){
     var state = document.getElementById(email_choice).style.display;
     
     if (value == '1'){
    	document.getElementById(email_choice).style.display = 'block';
     }else{
     	document.getElementById(email_choice).style.display = 'none';
     }
     
     }
    </script>
    
    <form action="<?php echo $editFormAction; ?>" method="POST" name="form3">
    
    <select name="status" onchange="showDiv(this.value);">
          <?php
    do {  
    ?>
          <option value="<?php echo $row_job_status['id']?>"<?php if (!(strcmp($row_job_status['id'], $row_job['status']))) {echo "selected=\"selected\"";} ?>><?php echo $row_job_status['status']?></option>
          <?php
    } while ($row_job_status = mysql_fetch_assoc($job_status));
      $rows = mysql_num_rows($job_status);
      if($rows > 0) {
          mysql_data_seek($job_status, 0);
    	  $row_job_status = mysql_fetch_assoc($job_status);
      }
    ?>
        </select>
    
    
    <div id="email_choice" style="display: none">    
     {check box here}
    </div>
    
    
    </form>
    i am sorry for the php in there! just ignore it
    that is a cut down version of my page the relivent infomation is there.

    summary

    when completed is selected in the drop down box the div email_choice shows it content

    that is it

    thanks you very much for your time

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    document.getElementById(email_choice)
    That should be
    Code:
    document.getElementById("email_choice")
    (or within single quotes)
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •