Networking | Hardware | Software | Multimedia | System | Unix&Linux | MBA

Home>>Hardware>>Moz, onkeyup and readOnly problem

Moz, onkeyup and readOnly problem

Kor
10-12-2005, 10:52 AM
The folowing code works improperly in FF. It supposes to make one of the textfields read-only if the other has some input in it. Works OK in IE, but in FF if I delete (with backspace) the input in one of the textfields, the other remains read-only... Why?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<script type="text/javascript">
function switchT(a,w){
var b = document.getElementById(w);
(a.value.length>0)?b.setAttribute('readOnly',true):b.setAttribute('readOnly',false)
}
</script>
</head>
<body>
<input id="txt1" type="text" onkeyup="switchT(this,'txt2')"><br>
<input id="txt2" type="text" onkeyup="switchT(this,'txt1')">
</body>
</html>


 

TOP

For more info

setting a minimum size
Auto Preview of Image 
Refresh with a query s
JS Validation obsolete
Javascript Pop up func
Slide show transitions
I'm a newbie...please!
how to write coding in
Advanced Debug Info 
.js file doesn't work 

News Archive

Adding Graphic To Text
re-direct form after s
pop up window controls
Clock on homepage - He
passing a param from a
Password Procection wi
document.title in same
focus onload 
Counting Wrong from Ri
Help needed on how to 

Related stories:

onclick
Input text filed
Create text boxes on the fly

Copyright@2004-2005 www.zzcoke.com All Right Reserved

advanced web statistics