Welcome to Dream.In.Code
Getting Help is Easy!

Join 119,059 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,419 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



use two function on click button

 
Reply to this topicStart new topic

use two function on click button, how to use two fuction on click button

dharam1248
post 22 Jul, 2008 - 10:36 PM
Post #1


New D.I.C Head

*
Joined: 5 Jul, 2008
Posts: 5

i want to know that how to use two function on click button in java scripts.
tell me easy way to use that
User is offlineProfile CardPM

Go to the top of the page


Martyr2
post 22 Jul, 2008 - 10:47 PM
Post #2


Programming Theoretician

Group Icon
Joined: 18 Apr, 2007
Posts: 4,676



Thanked 125 times

Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions


Well one way you could do this is to have the button call one function and in the body of that function have it call two other functions. Another variation is call one function which at the end calls yet another function.

Another variation is to have both function calls in the button's onclick handler, just separate them with semicolons. I believe that will work.

So it is up to you as to which you want to do. smile.gif
User is online!Profile CardPM

Go to the top of the page

William_Wilson
post 23 Jul, 2008 - 12:49 AM
Post #3


lost in compilation

Group Icon
Joined: 23 Dec, 2005
Posts: 3,822



Thanked 10 times

Dream Kudos: 3275

Expert In: Java, C, Javascript

My Contributions


both ways will work, the easiest to keep track of, may be to create a handler function, which dispatches both calls:
CODE

function button_click()
{
      call1();
      call2();
}
User is online!Profile CardPM

Go to the top of the page

dharam1248
post 1 Aug, 2008 - 01:38 AM
Post #4


New D.I.C Head

*
Joined: 5 Jul, 2008
Posts: 5

thnk u William
User is offlineProfile CardPM

Go to the top of the page

huzi8t9
post 28 Aug, 2008 - 06:06 AM
Post #5


New D.I.C Head

*
Joined: 11 Jul, 2007
Posts: 23


My Contributions


CODE

function1.Hello = function (msg)
{
          alert(msg);
}
function1.Bye = function (msg)
{
           alert(msg);
}

<a href='java script:void(0)' onclick='function1.hello("Hiya"); function1.bye("C ya!");'>Recieve Message.</a>


Just a simple way to do it smile.gif
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/13/08 04:05PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month