View Single Post
  #4 (permalink)  
Old 08-04-2008, 05:04 PM
curtiss's Avatar
curtiss curtiss is offline
Moderator
 
Join Date: May 2003
Posts: 1,468
The problem is within the code I provided, which carried over to the code you are using.

Sorry, I sometimes forget which language I'm coding in, and use the wrong constructs.

Try it this way:
Code:
<script type="text/javascript" language="javascript">
function showfield(what) {
if(what.id == "cb1" && what.checked) {
document.getElementById('text1').style.display = "inline";
}
else if(what.id == "cb1" && !what.checked) {
document.getElementById('text1').style.display = "none";
}
else if(what.id == "cb2" && what.checked) {
document.getElementById('text2').style.display = "inline";
}
else if(what.id == "cb2" && !what.checked) {
document.getElementById('text2').style.display = "none";
}
else {
document.getElementById('text1').style.display = "none";
document.getElementById('text2').style.display = "none";
}
}
</script>
In javascript, a single equal sign will assign the value on the right to the variable on the left. In order to test equivalency, you need two equal signs, together.

Doing a lot of work in VBScript, recently, which uses a single equal sign for everything.
__________________
I hate Internet Explorer! Anyone with me?
Reply With Quote