View Full Version : dropdown box show div

03-02-2011, 06:58 PM
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

function showDiv(value){
var state = document.getElementById(email_choice).style.display;

if (value == '1'){
document.getElementById(email_choice).style.display = 'block';
document.getElementById(email_choice).style.display = 'none';


<form action="<?php echo $editFormAction; ?>" method="POST" name="form3">

<select name="status" onchange="showDiv(this.value);">
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>
} 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);

<div id="email_choice" style="display: none">
{check box here}


i am sorry for the php in there! just ignore it :D
that is a cut down version of my page the relivent infomation is there.


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

03-03-2011, 08:36 AM
document.getElementById(email_choice) That should be

document.getElementById("email_choice") (or within single quotes)