473,387 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 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 1261
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: vincent delft | last post by:
Hello, I must set-up an application with an Oracle Database running on Unix and a GUI running on Windows 2000/XP machines. The size of the DB is about 5GB. The application will have about 1000...
1
by: Bo Xu | last post by:
Object of Combination By Bo Xu Introduction A combination of n things, taken s at a time, often referred as an s-combination out of n, is a way to select a subset of size s from a given set of...
3
by: gdogg1587 | last post by:
Greetings. I'm working on a program that will "descramble" words. Think of a word scramble game where there is a list of characters, and several blank spaces to denote the word(s) that you are...
15
by: Generic Usenet Account | last post by:
While I have a very good feel for how inlining works, I fail to see how in the world inlining can work if the inlined function is not described "in place" in a header file, but rather defined in a...
11
by: becte | last post by:
What does the standard say about f(x++) ? 1. x is incremented and then the that value is used in function f, i.e. x++; f(x); 2. the value of x (before ++) is send to f and after returning. x is...
24
by: gswork | last post by:
Let's write a c program, without knowing what it does... Some of you may recall Jim Roger's excellent series of posts (on comp.programming) exploring the implementation of common software...
19
by: viki1967 | last post by:
Hi all. I should work this control with javascript: First select: 1) Frank 2) Anthony 3) Max 4) Mark 5) Vincent
20
by: sophia | last post by:
Dear all, The following is the program which i have done to find all the combination of letters in the string "hello" #include<stdio.h> #include<stdlib.h> #include<string.h> #define MAX 5
10
by: thomas | last post by:
Hi, It's known that strdup() returns a char* type, but sometimes the following code generates warning messages. char *x = ... char *p = strdup(x); You must change it to
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.