471,573 Members | 1,147 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,573 software developers and data experts.

why does this combination of function not work?

bob
Hi,

This script executes only the first function (window.onload) but not the
second. I don't understand why. See the code:

<SCRIPT LANGUAGE=JAVASCRIPT>
function window.onload()
{ a=1
document.writeln("<pre>")
document.writeln(a)
document.writeln("</pre>") }

function test()
{a=2
document.writeln("<pre>")
document.write(a)
document.writeln("</pre>") }
document.onclick=test()
</SCRIPT>

Thanks
bob
Jul 20 '05 #1
2 1234
try

document.onclick = test;

"bob" <eg***@efgd.er> wrote in message news:bi**********@reader10.wxs.nl...
Hi,

This script executes only the first function (window.onload) but not the
second. I don't understand why. See the code:

<SCRIPT LANGUAGE=JAVASCRIPT>
function window.onload()
{ a=1
document.writeln("<pre>")
document.writeln(a)
document.writeln("</pre>") }

function test()
{a=2
document.writeln("<pre>")
document.write(a)
document.writeln("</pre>") }
document.onclick=test()
</SCRIPT>

Thanks
bob

Jul 20 '05 #2
bob
thanks
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by vincent delft | last post: by
15 posts views Thread by Generic Usenet Account | last post: by
11 posts views Thread by becte | last post: by
20 posts views Thread by sophia | last post: by
10 posts views Thread by thomas | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Vinnie | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.