Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > why does this combination of function not work?

Reply
Thread Tools

why does this combination of function not work?

 
 
bob
Guest
Posts: n/a
 
      08-21-2003
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


 
Reply With Quote
 
 
 
 
steve stevo
Guest
Posts: n/a
 
      08-21-2003
try

document.onclick = test;

"bob" <(E-Mail Removed)> wrote in message news:bi1se0$ch9$(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
 
bob
Guest
Posts: n/a
 
      08-21-2003
thanks


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why a member function will override an free function with the samename even if the arguments does not match? Peng Yu C++ 4 09-20-2008 02:00 PM
combination function in python DanielJohnson Python 17 04-17-2007 01:42 AM
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
why why why does function not work Horace Nunley ASP .Net 1 09-27-2006 09:52 PM



Advertisments