|
-
Feb 24th, 2003, 07:40 PM
#1
Thread Starter
Hyperactive Member
Running Javascript when Link is clicked
Ok i am fairly new to Javascript programming. What i need to do is make a HTML webpage. On this webpage i will be placing a few links. What i need is to find out how i can make it so when a link is clicked a few lines of Javascript execute. Currently for testing purposes i am running my javascript in the head header of my HTML page. What needs to be done in order to achieve my goal.
Code is greatly appreciated.
Thanks
-
Feb 24th, 2003, 08:26 PM
#2
Fanatic Member
you use the onmouseclick parameter in the link tag.
-
Feb 24th, 2003, 09:57 PM
#3
Code:
<script language="javascript">
function whoozie(){
//code
//code
end function
</script>
later on in your page...
<a href="#" onClick="javascript:whoozie();">Click here</a>
-
Feb 24th, 2003, 11:36 PM
#4
Member
Language has been deprecated in favor of type, and the language for the value of the intrinsic event should be defined in a meta declaration.
Code:
<meta http-equiv="Content-Script-Type" content="text/javascript">
<script type="text/javascript">
function foo() {
}
</script>
<p><a href="going_here_if_no_js.html" onclick="foo(); return false">click me</a></p>
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
|