Can more than one javascript function be performed with a
single onClick? If so, how would it be written?
Les
You can put any amount of JavaScript code in an HTML
onClick event. eg
input type = "button" onClick="doThis(x);doThat();a=b"
You are only restricted to one function if you want to
input type=button . onClick="javascript:function1();function2();"
Or you could call function2() from function1()
From: zac [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Subject: Re: Two functions with a single onClick?
Date: Wed, 21 Feb 2001 21:1
Simply seperate the two function calls with a semicolon, as in onClick="alert('hi');
alert('bye');". Or write one function that calls the two functions.
Craig
-Original Message-
From: Les Irvin [SMTP:[EMAIL PROTECTED]]
Sent: Wednesday, February 21, 2001 11:16 PM
To: CF-Talk
Les, here's some code for you. HTH.
david
-
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
html
head
titleUntitled/title
script language="JavaScript"
!--
function doTwo(){
doFirst();
doSecond();
}
function doFirst(){
alert("I'm the first
One way would be to have the onclick event call one fuction that in turn
calls the next function.
-Original Message-
From: Les Irvin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 22, 2001 9:58 AM
To: CF-Talk
Subject: Two functions with a single onClick?
Can more than one
like let's say i wanna do 3 functions. i write the functions in the
javascript. then i clal them in the OnClick
let's say those functions are GetPie, GetPizza, GetLaid
the onclick would be like. onclick="GetPie();GetPizza(), GetLaid"
-Original Message-
From: Les Irvin
onclick="function1(); function2();"
-Original Message-
From: Les Irvin [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 21, 2001 2:58 PM
To: CF-Talk
Subject: Two functions with a single onClick?
Can more than one javascript function be performed with a single
onClick? If so, how
onClick="function1();function2()"
Joby Bednar
Director of Internet Design
iNEOgroup.com
http://www.ineogroup.com http://www.ineogroup.com
Fusing your Dreams and the Web, Together as One
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
Cell: 949-283-5138
Personal Fax: 208-485-1170
-Original
or you can just call both functions from the onClick event like so:
onclick="doOne(); doTwo()"
-Original Message-
From: David Baskin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 22, 2001 9:27 AM
To: CF-Talk
Subject: RE: Two functions with a single onClick?
Les, here's
Depending on your tag and if it is supported, I have used the inout tag to
give you an idea
script
function Test() {
alert("Hello")
alert("Function call #2")
return true;
}
/script
form
input type="submit" name="test" onClick="Test();"
/form
-Original Message-
From: Les
Haven't used this with onclick, but this works with onsubmit, so I imagine
it would be no different
onsubmit="javascript:MyFunction1();javascript:MyFunction2();javascript:MyFun
ction3();javascript:MyFunction4();"
-Original Message-
From: Les Irvin [mailto:[EMAIL PROTECTED]]
Sent:
In addition to calling a custom function, you can also string javascript
calls in your onClick like so.
a href="#" onClick="opener.focus();window.close();"Close/a
jon
- Original Message -
From: "Les Irvin" [EMAIL PROTECTED]
To: "CF-Talk" [EMAIL PROTECTED]
Sent: Wednesday, February 21,
You could just put them all together. The following code works for me. We
have an upload link that opens a page, places today's date in a text input
box and sets a hidden variable. Pretty crazy, but I had to do it this way
because I had dynamic variables to pass to the new window and which
=(somethingelse);document.formname.submit(
);" on it, to divert the form elsewhere and submit it.
- Original Message -
From: "David Baskin" [EMAIL PROTECTED]
To: "CF-Talk" [EMAIL PROTECTED]
Sent: Wednesday, February 21, 2001 4:27 PM
Subject: RE: Two functions with a single onClic
o: CF-Talk
Subject: RE: Two functions with a single onClick?
Haven't used this with onclick, but this works with onsubmit, so I imagine
it would be no different
onsubmit="javascript:MyFunction1();javascript:MyFunction2();javascript:MyFun
ction3();javascript:MyFunction4();"
-Origin
Haven't used this with onclick, but this works with onsubmit, so I imagine
it would be no different
onsubmit="javascript:MyFunction1();javascript:MyFunction2();javasc
ript:MyFun
ction3();javascript:MyFunction4();"
No need for the "javascript:" entries there; the language is assumed in an
--
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Haven't used this with onclick, but this
works with onsubmit, so I imagine it would
be no different
--
an event handler is an event handler. they all work fundamentally the
Can more than one javascript function be performed with a single
onClick? If so, how would it be written?
Write one function that handles both tasks and then call that function in
the onClick statement.
What two tasks are you trying to do?
--
It is dangerous to be right when the
18 matches
Mail list logo