I have the following code:
Code:
function checkForErrors(server, port, username, password, password2, name, reference) {
var errorFields = '';
if (server != '<font color="green">OK</font>') {
errorFields = errorFields + "Database Server Address\n"
}
if (port != '<font color="green">OK</font>') {
errorFields = errorFields + "Database Server Port\n"
}
if (username != '<font color="green">OK</font>') {
errorFields = errorFields + "Database UserName\n"
}
if (password != '<font color="green">OK</font>') {
errorFields = errorFields + "Database Password\n"
}
if (password2 != '<font color="green">OK</font>') {
errorFields = errorFields + "Confirm Password\n"
}
if (name != '<font color="green">OK</font>') {
errorFields = errorFields + "Database Name\n"
}
if (reference != '<font color="green">OK</font>') {
errorFields = errorFields + "Your Reference Name\n"
}
if (errorFields.length != 0) {
alert("There were errors with: \n\n" + errorFields + "\nPlease correct them.")
}
else {
document.addDB.submit();
}
}
Which is called when you click a button:
Code:
<input type="button" name="butAdd" value="Add" onclick="checkForErrors(document.getElementById('txtServerOK').innerHTML, document.getElementById('txtPortOK').innerHTML, document.getElementById('txtUserOK').innerHTML, document.getElementById('txtP1OK').innerHTML, document.getElementById('txtP2OK').innerHTML, document.getElementById('txtNameOK').innerHTML, document.getElementById('txtOK').innerHTML)" />
This works fine in FireFox however Opera and IE tell me that every field has an error. Anyone know what's wrong here?
Thanks
~Phil~