I have four text fields in my form. When the user enters some value in any one of the fields, I want to disable other text fields. How can I get this to work in both Netscape and IE?

Ravi Verelly

The below code works in Netscape and IE:

<script language="JavaScript">
var flg = false;
function chk(){
var field = window.document.f1;
if (field.t1.value.length==0&&
function disablef(which){
if(flg&&which.value.length==0) which.blur();
else flg = true;
<form name="f1">
<input type="text" name="t1" onfocus="disablef(this);">
<input type="text" name="t2" onfocus="disablef(this);">
<input type="text" name="t3" onfocus="disablef(this);">
<input type="text" name="t4" onfocus="disablef(this);">
</form> </body> </html>
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact