Posts: 427
Name: Stuart
Location: Glasgow, Scotland
|
Hey
I have a page that I'm trying to add a client-side validation script to (downloaded from http://www.vikaskbh.com/) it works great in the other pages i have added it to but not so in a page which already contains some JavaScript.
I think it may have something to do with both of the scripts containing an "window.onLoad" part which may conflict with each other (may be completely off but a thought...
I have experimented with the order in which the code is included and i can get both of the bits to work but just not at the same time
Is there a way in which i can combine the two onLoad pieces so they run at the same time (if this is, infact, the problem)
Ill just include the onLoad line here but ill link it incase you want to see the entire script.
Code:
var hiddenDivs = new Array();
window.onload = function() {
//gets the all hidden divs so we can reset them all to hidden when we choose a new one
var myDivs = document.getElementsByTagName("DIV");
for (i=0; i<myDivs.length; i++) {
if (myDivs[i].className == "city") {
//hide them as we enter them into the array - if JS is on - they're hidden, and if JS is off we still see al of them
myDivs[i].className = "hiddenCity";
hiddenDivs.push(myDivs[i]);
}
}
}
Validation:
Code:
window.onload = getFormDetails;
//code omitted..
function getFormDetails()
{
numberOfForms = document.forms.length;
if(numberOfForms!=0)setUpValidation();
else return;
}
Thanks a lot for any help
Stoot
Full Validate Code
|