469,282 Members | 1,694 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

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 1211
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
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.