Return to Snippet

Revision: 62627
at March 3, 2013 21:02 by apphp-snippets

Initial Code
<script type="text/javascript">
// 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);

Initial URL

Initial Description
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.

Initial Title
Pass Parameters in SetInterval() function in JavaScript

Initial Tags

Initial Language