Simple use of w3school
There are no parameters in it.
Examples are as follows
The code copy is as follows:
<script type="text/javascript">
function timedMsg()
{
var a ="dd";
var t=setTimeout(function(){ cao(a);},3000)
}
function cao(a)
{
alert(a);
}
</script>
</head>
<input type="button" value="Show timed warning box" onClick = "timedMsg()">
My problem now is that there are multiple ones, and I will only send the last one back. Think about it
Still don't quite understand, I understand
The code copy is as follows:
/* for (var i=0;i<points.length;i++){
AddGuiJi(points[i],value);
//var t=setTimeout(function(){ AddGuiJi(points[i],value);},2000*i)
} */
The reason for the error above is that when time is triggered to execute, i=4, so although there are multiple, it is always the last one.
Solution
The code copy is as follows:
var timerr;
function xunhuanlian(points,value){
if(replayi<points.length){
AddGuiJi(points[replayi],value);
replayi++;
timerr=setTimeout(function(){ xunhuanlian(points,value);},1000);
}
else{
replayi =0;
clearTimeout(timerr);
}
/* for (var i=0;i<points.length;i++){
AddGuiJi(points[i],value);
//var t=setTimeout(function(){ AddGuiJi(points[i],value);},2000*i)
} */
}