Click to See Complete Forum and Search --> : check box data binding


shanuragu
06-02-2003, 04:04 AM
Hi friends

I have two text boxes (t1 & t2) arranged one beside the other in a form & a check box located at the bottom.

My problem is when I enter a value in t1 & click the check box the same value should be displayed in t2. When the check is removed the value in t1 should remain unchanged where as the value in t2 should automaticaly be removed.

Can any one help me.

Regards

ShaRa:(

JHL
06-02-2003, 04:28 AM
<html>
<head>
<script type="text/javascript">
function doSomething(f){
if(f.chk.checked)
f.txt2.value = f.txt1.value;
else
f.txt2.value = "";
}
</script>
</head>
<body>
<form id="f">
<input type="text" id="txt1"><input type="text" id="txt2">
<br>
<input type="checkbox" id="chk" onClick="doSomething(this.form)">
</form>
</body>
</html>

shanuragu
06-02-2003, 04:53 AM
It is working fine..
Many Thanks

ShaRa:D