...

View Full Version : dropdown box show div



phpcodelearner
03-02-2011, 05: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


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

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

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum