Well, I'm back from vacation and still working on this little routine. My test page now looks like this.
<code>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<!-- Created with the CoffeeCup HTML Editor 2007 -->
<!--
-->
<!-- Brewed on 11/29/2007 2:18:03 PM -->
<head>
<title>Contacts</title>
<style>
.noedit{background: gray;}
</style>
<script language="JavaScript">
function ClearReadOnly(){
var inputs = document.getElementsByTagName("input");
var i=0 ;
for (i=0;i<=inputs.length;i++){
alert(inputs.type) ;
}
}
</script>
</head>
<body>
<!-- Start of FORM -->
<form method="post" action="" name="form1">
<input type="text" name="txt1" class="noedit" value="" readonly>
<input type="text" name="txt2" class="noedit" value="" readonly>
<input type="button"
name="cmdEdit"
value="Edit"
style="width: 100px"
onclick="ClearReadOnly();">
<!-- End of FORM -->
</form>
</body>
</html>
</code>
The alert will fire 4 times meaning that the inputs collection must include something besides the 2 textboxes and the button. (the form maybe?) Adding the if statement produces an error because the unknown extra input does not have a "type". Do you know what the unknown input is and how to deal with it?