Friday, November 30, 2007

Javascript - Calling Multiple function in Anchor

There are 2 method to call Multiple function in Anchor,

Let there are function1 and function2 is avaliable.
<SCRIPT LANGUAGE="JavaScript">
<!--
function function1(){
alert("Called function1");
}
function function2(){
alert("Called function2");
}
//-->
</SCRIPT>

Method 1:
Call the both function in the directly from anchor.
1. <a href="#" onclick="javascript:function1(),function2();"> anchorText
</a>

Method 2:
Have another common function that will call the both function
function1,function2 from anchor.

1.
<SCRIPT LANGUAGE="JavaScript">
<!--
function common_function(){
function1();
function2();
}
//-->
</SCRIPT>

2.<a href="#" onclick="javascript:common_function();"> anchorText </a>

No comments:

Adobe News