something like (for check box):
add onBlur Event to text box ie:
<input type="text" id="text" name="textinput" onblur="fixCheck();">
add to head in script tags:
function fixCheck()
{
if(document.formname.textinput.value!="")
{
//set check box
document.formname.button2.value="on" //might be checked or 1
}
else
{
//clear check box
document.formname.button2.value="off" //might be unchecked or -1
}
}
quickie answer, hope it helps/////////
-----Original Message-----
From: Rowenap@w... [mailto:Rowenap@w...]
Sent: Thursday, September 21, 2000 3:35 PM
To: javascript
Subject: [javascript] ASP, Javascript
-----Original Message-----
From: Benny Tjahjono [mailto:btjahjono@m...]
Sent: 20 September 2000 15:43
To: 'Rowenap@w...'
Subject: ASP, Javascript
Hi Rowena,
I got your name from ASP newsgroups and would like to ask for your help
here:
1.)
I have a checkbox and a textbox. How do I write the javascript such that
if
the textbox is populated then the checkbox will automatically be checked
and
if the textbox later is emptied then the checkbox will automatically be
unchecked?
2.)
Suppose that my html code has a couple of radio buttons enclosed in a form
<form name="formname" action="action.asp" method="post">
<input type="radio" id="button1" name="button1">
<input type="radio" id="button2" name="button2">
and a textbox input
<input type="text" id="text" name="textinput">
My question is how do I rewrite the code, i.e. what command in Javascript
is
written, such that once the textinput is filled with data, the radio
button2
is automatically selected