justrick
10-31-2003, 12:49 PM
I have a PHP calculating form that shows zeros by default in the text input fields. I wrote a simple Javascript to remove the zeros from the fields on load so the user doesn't have to highlight them before typing the numbers in. The script works fine in IE4+, but will not work in Netscape 4.76, 6.0 or 7.0.
This is the script:
<script type="text/javascript">
function ClearFields(){
if (myform.txtFldA.value=="0"){
myform.txtFldA.value="";
}
if (myform.txtFldB.value=="0"){
myform.txtFldB.value="";
}
if (myform.txtFldC.value=="0"){
myform.txtFldC.value="";
}
if (myform.txtFldD.value=="0"){
myform.txtFldD.value="";
}
return true
}
</script>
<body onLoad="ClearFields()">
Is this a Netscape thing, or am I doing someting wrong?
(BTW, I'm a newbie)
This is the script:
<script type="text/javascript">
function ClearFields(){
if (myform.txtFldA.value=="0"){
myform.txtFldA.value="";
}
if (myform.txtFldB.value=="0"){
myform.txtFldB.value="";
}
if (myform.txtFldC.value=="0"){
myform.txtFldC.value="";
}
if (myform.txtFldD.value=="0"){
myform.txtFldD.value="";
}
return true
}
</script>
<body onLoad="ClearFields()">
Is this a Netscape thing, or am I doing someting wrong?
(BTW, I'm a newbie)