PDA

View Full Version : onload event.


karthikraja
09-08-2006, 11:28 AM
Is ther any other events which gets triggered before onload event?? Kindly let me know. I want to execute some piece of code before onload event.

Vege
09-08-2006, 11:35 AM
put the function call before the other function call in the onload event?

karthikraja
09-09-2006, 12:13 AM
Thanks for the info. But that dint help me. Actually my idea was to know is there ay other event which gets triggered before the onload event. Thanks.

_Aerospace_Eng_
09-09-2006, 02:33 AM
Thanks for the info. But that dint help me. Actually my idea was to know is there ay other event which gets triggered before the onload event. Thanks.
No. If you want the function to run before the onload you would need to call it directly in the body or the head tags making sure if the element you are trying to access has been already created. If not the script will error out. You can usually do this by placing the function call after the element in the document or check to see if the element exists by using an if statement.

blackpepper
09-09-2006, 09:30 AM
isnt server side technically before onload? or am i just wrong there.

_Aerospace_Eng_
09-09-2006, 10:10 AM
You can't run javascript before its reached the client hence why javascript is a clientside language.

karthikraja
09-09-2006, 10:39 AM
Oh god............. Please save meeeeeeeeeeeeeeee
I just wanted to know is there any other function that can be called before onload function. Thats all. Is this onload the first function which JS offers or is there any other one??

blackpepper
09-09-2006, 01:27 PM
You can't run javascript before its reached the client hence why javascript is a clientside language.
i kno i kno, im saying, what about accomplishing what he wants with php? that essentially would run before a javascript using onload would. It depends on what's trying to be done here doesnt it?

_Aerospace_Eng_
09-09-2006, 04:46 PM
Sure but until the OP responds we can only assume that he is trying to run some type of client side script. Maybe he can accomplish the same thing with php we don't know. So karthikraja what is it that you are trying to do? What is the purpose of your script? I already told you that there is nothing else that loads before onload unless a direct function call. You have given us very little information to help you by. Help us help you.

karthikraja
09-13-2006, 12:12 AM
Sorry for the delay in responding.
Ok, let me explain. I have a tool which puts the code on the webpage address bar and executes my statements. like javascript: alert('hi').
Now in my website I have a onload function already. The javascript which I execute from my tool (proprietory language, should not expose the tool name) just runs on the address bar.
Now I have a set of statements written in that tool, which executes before onload function in the webpage. Now I want to know what isthat command which gets executed before onload event.
I hope my statement is clear. Let me know if you want some more clarifications.

Thanks

_Aerospace_Eng_
09-13-2006, 12:18 AM
Like we've been telling you, its likely a direct function call so something like
<script type="text/javascript">
nameoffunction();
</script>
That calls a function in one of your defined scripts somewhere. If placed in the body it will likely be called before the onload. Its not an event, its a DIRECT, I repeat direct function call.