J
Jürgen Heyn
Good morning,
on form 2 input elements and 1 image are placed. The 1st (Index[0]) one is
"hidden", the 2nd [Index[1]) is an empty textbox.
When clicking the picture I would like to toogle a boolean value. (displayed
in the textbox).
The following function reacts correctly on the first click. Any further
click as no effect (is returns "TRUE" in the textbox).
Where is the mistake ? How can I solve the problem ?
Thank you very much in advance.
Best regards
Juergen Heyn, Wilhelmshaven, Germany
<script language="JavaScript">
<!--
function toggle()
{
if(document.forms[0].elements[0].value="yes")
{
document.forms[0].elements[1].value="TRUE";
document.forms[0].elements[0].value="no";
}
else
{
document.forms[0].elements[1].value="FALSE";
document.forms[0].elements[0].value="yes";
}
}
// -->
</script>
<body>
<form action="">
<p>
<input type="hidden" name="YesNo" value="yes">
<input type="text" name="Textbox" size="20">
<a href="#" onClick=toggle()>
<img src="Button.gif" border="0" width="36" height="36">
</p>
</form>
</body>
on form 2 input elements and 1 image are placed. The 1st (Index[0]) one is
"hidden", the 2nd [Index[1]) is an empty textbox.
When clicking the picture I would like to toogle a boolean value. (displayed
in the textbox).
The following function reacts correctly on the first click. Any further
click as no effect (is returns "TRUE" in the textbox).
Where is the mistake ? How can I solve the problem ?
Thank you very much in advance.
Best regards
Juergen Heyn, Wilhelmshaven, Germany
<script language="JavaScript">
<!--
function toggle()
{
if(document.forms[0].elements[0].value="yes")
{
document.forms[0].elements[1].value="TRUE";
document.forms[0].elements[0].value="no";
}
else
{
document.forms[0].elements[1].value="FALSE";
document.forms[0].elements[0].value="yes";
}
}
// -->
</script>
<body>
<form action="">
<p>
<input type="hidden" name="YesNo" value="yes">
<input type="text" name="Textbox" size="20">
<a href="#" onClick=toggle()>
<img src="Button.gif" border="0" width="36" height="36">
</p>
</form>
</body>