Webmastersite.net
Register Log In

Onload events

Title Onload events
Message Text 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?
Rating
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5
0/5 based on 0 votes.
Ownership webflair
Views 190 views. Averaging 0 views per day.
Similar Topics
Submission Date Sep 01, 2010 - 2:41 PM