Created
November 4, 2012 20:17
-
-
Save apphp-snippets/4013493 to your computer and use it in GitHub Desktop.
You may perform this work with two ways: pass it directly like described in sample #1 or use an anonymous function like its shown in sample #2.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type="text/javascript"> | |
| /* Source: http://www.apphp.com/index.php?snippet=javascript-pass-parameters-in-setinterval */ | |
| // sample #1 | |
| setInterval('alert_function(1)', 1500); | |
| // sample #2 | |
| setInterval(function(){ alert_function(10); }, 1500); | |
| // user's alert function | |
| function alert_function(val){ | |
| alert("Passed parameter is: " + val); | |
| } | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment