how do we run function after the page is completely loaded. 
Author Message
 how do we run function after the page is completely loaded.

Hi
I am customizing a page.
I cannot use <body onload="...">
but is there a way to run run() after page is loaded when run is defined
after button?
<button onclick="run();">
<script>
function run()
{...}
</script>

Thank you very much



Sun, 27 Jun 2004 04:14:18 GMT  
 how do we run function after the page is completely loaded.
Yes.

<INPUT TYPE="button" VALUE="Click Me!" onClick="run();" />

<SCRIPT LANGUAGE="JScript">
<!--
function run() {
 // your code goes here.

Quote:
}

// -->
</SCRIPT>

It looked like you didn't specify the open and close brackets after the
function declaration.  Unlike Visual Basic and VBScript, you don't use End
Function.  You use { }.
note:
function myFunction(parameter1, parameter2) {
// code
// ...
// code

Quote:
} // the close bracket acts the same as VB's "End Function".

--Robert Paveza


Quote:
> Hi
> I am customizing a page.
> I cannot use <body onload="...">
> but is there a way to run run() after page is loaded when run is defined
> after button?
> <button onclick="run();">
> <script>
> function run()
> {...}
> </script>

> Thank you very much



Sun, 27 Jun 2004 13:02:28 GMT  
 how do we run function after the page is completely loaded.
If you want it to happen on page load, but leave the body tag alone, try (in
the body of the page)-

<script language=javascript>

window.oldonload = window.onload;
window.onload = something();

function something() {

   window.oldonload();   // This calls whatever onload handler the page had
before
                                     // so this is 'added' to the page load
handler already there

    run();

Quote:
}

</script>

hth
Justin Dutoit


Quote:
> Hi
> I am customizing a page.
> I cannot use <body onload="...">
> but is there a way to run run() after page is loaded when run is defined
> after button?
> <button onclick="run();">
> <script>
> function run()
> {...}
> </script>

> Thank you very much



Sun, 27 Jun 2004 15:30:32 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Loading a page with javascript functions (Always load a cached page)

2. Not running, am I doing something wrong

3. how do I display a 'page loading...'- image while actual page is loading

4. When page loads, load a page in another frame

5. onkeypress - what am i doing wrong

6. newbie - what am I doing wrong?

7. What am I doing wrong?

8. What I am doing wrong.

9. Am i doing right?

10. Am I doing right?

11. Am I doing this right?

12. exitserver and settransfer, what am I doing wrong?

 

 
Powered by phpBB® Forum Software