<Body onload= > question

Reply

Join Date: Mar 2005
Posts: 1
Reputation: maj is an unknown quantity at this point 
Solved Threads: 0
maj maj is offline Offline
Newbie Poster

<Body onload= > question

 
0
  #1
Mar 25th, 2005
Hi there,

I have some java script menus created and I'm calling them from the <body onload> tag as follows:

<body onload="initjsDOMenu()">

Because of this, the menu is the last thing to load on the page. I want it to be the first thing to load. Anyone know what I can do?

Thanks for any help,
Maj
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: <Body onload= > question

 
0
  #2
Mar 25th, 2005
instead of sticking it in the body onload, have you tried calling it in the header of the page:

HTML and CSS Syntax (Toggle Plain Text)
  1. <HTML>
  2. <HEAD>
  3. <SCRIPT LANGUAGE="Javascript">
  4. function some_function()
  5. {
  6.  
  7. }
  8.  
  9. some_function();
  10. </SCRIPT>
  11. </HEAD>
  12. <!-- The Rest Of The Page -->
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 6
Reputation: vivek vermani is an unknown quantity at this point 
Solved Threads: 0
vivek vermani vivek vermani is offline Offline
Newbie Poster

Re: <Body onload= > question

 
0
  #3
Nov 22nd, 2005
Originally Posted by maj
Hi there,

I have some java script menus created and I'm calling them from the <body onload> tag as follows:

<body onload="initjsDOMenu()">

Because of this, the menu is the last thing to load on the page. I want it to be the first thing to load. Anyone know what I can do?

Thanks for any help,
Maj
call this function at the javascript section under head tag.
<head>
<javascript>
function();
</javascript>
</head>
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 49
Reputation: felgall is an unknown quantity at this point 
Solved Threads: 1
felgall felgall is offline Offline
Light Poster

Re: <Body onload= > question

 
0
  #4
Nov 26th, 2005
Originally Posted by vivek vermani
<javascript>
function();
</javascript>
What language is that written in? It isn't HTML or XHTML because they use <script type="text/javascript"> to call Javascript.
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 182
Reputation: alpha_foobar is an unknown quantity at this point 
Solved Threads: 3
alpha_foobar's Avatar
alpha_foobar alpha_foobar is offline Offline
Junior Poster

Re: <Body onload= > question

 
0
  #5
Dec 3rd, 2005
thats what they mean... you can call a javascript function from anywhere on the page, as long as it is in the script tags you describe.
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 49
Reputation: felgall is an unknown quantity at this point 
Solved Threads: 1
felgall felgall is offline Offline
Light Poster

Re: <Body onload= > question

 
0
  #6
Dec 3rd, 2005
Most times code within onload needs to be there because it references elements of the page that need to be loaded beforehand in order to be able to reference them. Moving the onload code to anywhere else will probably result in "object expected" errors because the part of the page that the script references hasn't loaded yet.
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 6
Reputation: vivek vermani is an unknown quantity at this point 
Solved Threads: 0
vivek vermani vivek vermani is offline Offline
Newbie Poster

Re: <Body onload= > question

 
0
  #7
Dec 5th, 2005
Originally Posted by felgall
What language is that written in? It isn't HTML or XHTML because they use <script type="text/javascript"> to call Javascript.
its just html code ...............sorry for writing it like that.............my motive was to just guide the way it would work..................
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the HTML and CSS Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC