-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jquery.html
51 lines (40 loc) · 830 Bytes
/
Jquery.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<div align="left"><html>
<head>
<script type ="text/javascript" src="http://code.jquery.com/jquery-1.7.js"></script>
<title></title>
</head>
<body>
<script type ="text/javascript">
function callAnotherFunction(arg1, arg2, arg3)
{
var times=$.isNumeric(arg1)? arg1: 4;
var delay = $.isNumeric(arg2)? arg2: 1000;
var funcToCall = $.isFunction(arg1)? arg1: $.isFunction(arg2) ? arg2 : arg3;
var i = 0;
(function loopit()
{
i ++ ;
funcToCall();
if (i < times)
{
setTimeout(loopit, delay);
}
}
)();
}
function functionToCall ()
{
$("#output").append("<br /> function called");
}
jQuery(function()
{
callAnotherFunction(functionToCall);
}
);
</script>
<h1>Type Test Functions Demo</h1>
<div id ="output">
</div>
</body>
</html>
<div align="left"></div></div>