sherlockturtle
07-27-2011, 11:47 PM
how would you make a function trigger a other function?
|
||||
Function trigger functionsherlockturtle 07-27-2011, 11:47 PM how would you make a function trigger a other function? nomanic 07-27-2011, 11:54 PM can you explain what you mean a little more please? sherlockturtle 07-27-2011, 11:58 PM can you explain what you mean a little more please? a function that when set off triggerd a other function? nomanic 07-28-2011, 12:01 AM like this? function a() { alert('function a called'); } function b() { //Some stuff in here //then trigger function a a(); } b(); sherlockturtle 07-28-2011, 12:25 AM like this? function a() { alert('function a called'); } function b() { //Some stuff in here //then trigger function a a(); } b(); Could you explain how the trigger function works? nomanic 07-28-2011, 12:31 AM im sorry i really dont know what youre asking, you want function b to call function a right? sherlockturtle 07-28-2011, 01:13 AM im sorry i really dont know what youre asking, you want function b to call function a right? Ya what i men is you put "//then trigger functin a" so how do a trigger a? tfburges 07-28-2011, 01:19 AM Hello sherlockturtle! nomanic's example does what you want, but let's run through a quick example for further proof. Suppose you have this function: function AlertOne(){ alert(1); } Any time the AlertOne function is called, like this: AlertOne(); It will be executed and you will of course get a popup (a.k.a., an alert) with the number 1 in it. So suppose you also have this function: function AlertTwo(){ alert(2); } Similarly, when the function is called using AlertTwo();, it will alert the number 2 just as it says within the function's brackets. Finally, suppose you have this function: function AlertOneAndTwo(){ AlertOne(); AlertTwo(); } Whenever the AlertOneAndTwo function is called, like this: AlertOneAndTwo(); AlertOne(); and AlertTwo(); will run as they are between the AlertOneAndTwo functions brackets... and so you'll see an alert with 1 and then an alert with 2. sherlockturtle 07-28-2011, 04:35 AM Hello sherlockturtle! nomanic's example does what you want, but let's run through a quick example for further proof. Suppose you have this function: function AlertOne(){ alert(1); } Any time the AlertOne function is called, like this: AlertOne(); It will be executed and you will of course get a popup (a.k.a., an alert) with the number 1 in it. So suppose you also have this function: function AlertTwo(){ alert(2); } Similarly, when the function is called using AlertTwo();, it will alert the number 2 just as it says within the function's brackets. Finally, suppose you have this function: function AlertOneAndTwo(){ AlertOne(); AlertTwo(); } Whenever the AlertOneAndTwo function is called, like this: AlertOneAndTwo(); AlertOne(); and AlertTwo(); will run as they are between the AlertOneAndTwo functions brackets... and so you'll see an alert with 1 and then an alert with 2. Ive tried that it does not work. tfburges 07-28-2011, 05:46 AM May I see your code? If you're using Internet Explorer, a yellow bar may appear at the top of the page asking if you want to allow javascript and you'll need to allow it of course if you want it to work. sherlockturtle 07-28-2011, 03:43 PM May I see your code? If you're using Internet Explorer, a yellow bar may appear at the top of the page asking if you want to allow javascript and you'll need to allow it of course if you want it to work. Im using chrome ill post my code in a little while i goto go so bye. |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum