|
-
Nov 22nd, 2000, 06:58 AM
#1
Thread Starter
Hyperactive Member
I have a javascript function on my page call checkout().
How can I call this function from anywhere in my page.
Presently I have it in my input statement like this..
<input type="button" onclick="checkout()" value="submit">
I want to be able to call this function anywhere/anytime in my page.
Thanks
-
Nov 22nd, 2000, 08:20 AM
#2
Frenzied Member
As simple as that :
<script language=javascript>
checkout();
</script>
-
Nov 22nd, 2000, 01:05 PM
#3
Something like this:
<SCRIPT LANGUAGE="JavaScript">
function myfunc(){
//-----Do your function----->
}
</SCRIPT>
And then you can call it whereever:
<body onLoad="myfunc()">
<input type="button" onclick="myfunc()" value="submit">
etc.
etc.
-
Nov 23rd, 2000, 05:40 AM
#4
Conquistador
i think
<input type="button" onclick="javascript:checkout()" value="submit">
also works
-
Nov 23rd, 2000, 09:50 AM
#5
Oops. da_silvy, javascript: function() is not needed. I don't believe you need the javascript: part.
And there is an error in my code.
This is incorrect:
<body onLoad="myfunc()">
<input type="button" onclick="myfunc()" value="submit">
This is correct:
<body onLoad="myfunc();">
<input type="button" onclick="myfunc();" value="submit">
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|