Running into a really weird issue, in my function() block, the if section runs both the true and the else code blocks, what am I doing wrong?
Any tips muchly appreciated. Ta
PS I know it's not finished yet wrt textareas.
Code:
function StyleAllInputs(){
var inputs = document.getElementsByTagName('input');
var texts = document.getElementsByTagName('textarea');
for (i=0; i<inputs.length; i++) { // loops through the inputs
//Set the style
inputs[i].className="default";
inputs[i].onclick=function() {
//Build arrays of elements we want to change
var inputs = document.getElementsByTagName('input');
var texts = document.getElementsByTagName('textarea');
//Reset all styles
for (i=0; i<inputs.length; i++) { // loops through the inputs
//Set the style
inputs[i].className="default";
}
for (i=0; i<texts.length; i++) { // loops through the inputs
//Set the style
texts[i].className="default";
}
//Then set the current one
if ((this.readOnly==true) || (this.enabled==false)) {
this.className="readonly";
} else {
this.className="editable";
}
}
}
}
Any tips muchly appreciated. Ta
PS I know it's not finished yet wrt textareas.