onload is essentially equivalent to jquery's document ready function, so put setDrops(document.searchform); in jquery/documentready.txt. That's the file (empty by default) to place any additional content that should be inserted to run when the page has fully loaded.
Comments on Onload events
Forum Regular
Usergroup: Customer
Joined: Nov 27, 2006
Total Topics: 187
Total Comments: 465
Hi
I am trying to add an onload event, but there is aready an onload in the code when the page loads, so my onload doesn't work.
Here's what I need to do...
I am trying to automatically set the date in some drop down form fields.
I wanted to add the following code to the opening body tag.. onload=setDrops(document.searchform)
and the following code to the head section...
<SCRIPT language=JavaScript>
<!--
var now = new Date();
var theday = now.getDate()-1;
var themonth = now.getMonth();
var theyear = now.getFullYear();
function setDrops(theForm) {
theForm.day.selectedIndex = theday;
theForm.month.selectedIndex = themonth;
var found = 0;
for(i=1;i<theForm.year.options.length;i++) {
if (theForm.year.options[i].value == theyear) {
found = i;
break;
}
}
theForm.year.selectedIndex = found;
}
//-->
</SCRIPT>
However, because WSN links already inserts an onload event, it doesn't work. How can I use my onload event with WSN links?
Forum Regular
Usergroup: Customer
Joined: Nov 27, 2006
Total Topics: 187
Total Comments: 465
I have now tried using this...
<script type="text/javascript>
setDrops(document.searchform);
</script>
at the bottom of the page, and it works in all browsers but Chrome, is there a solution that will work with all browsers?
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
onload is essentially equivalent to jquery's document ready function, so put setDrops(document.searchform); in jquery/documentready.txt. That's the file (empty by default) to place any additional content that should be inserted to run when the page has fully loaded.
Forum Regular
Usergroup: Customer
Joined: Nov 27, 2006
Total Topics: 187
Total Comments: 465
Brilliant, thanks Paul.