satish_j
10-14-2008, 12:58 PM
I came across a script on net that utilises the foll. syntax for calling setTimeoutfunction:
setTimeout("ScrollIt("+pos+")",pause);
where,ScrollIt is the function that accepts pos as argument and pause has a value of 100.
My question is How does the above syntax work???
I have never come across this syntax in any ebook.As you can see,it calls the function and then assigns the argument value using plus operator.This asignment is not clear to me.The entire code of function is as follows:
var message="Welcome to my Blog.#"+"Pls enter your Login Credentials.#"+"#";
var scrollspeed=85;
var lineDelay=2000;
var txt="";
function ScrollIt(pos)
{
if (message.charAt(pos)!='#') {
txt+=message.charAt(pos);
pause=scrollspeed;
window.status=txt; }
else {
txt="";
pause=lineDelay;
if (pos==message.length-1) pos=-1;
}
pos++;
//status=pos;
setTimeout("ScrollIt("+pos+")",pause);
}
can anyone pls explain me this?
setTimeout("ScrollIt("+pos+")",pause);
where,ScrollIt is the function that accepts pos as argument and pause has a value of 100.
My question is How does the above syntax work???
I have never come across this syntax in any ebook.As you can see,it calls the function and then assigns the argument value using plus operator.This asignment is not clear to me.The entire code of function is as follows:
var message="Welcome to my Blog.#"+"Pls enter your Login Credentials.#"+"#";
var scrollspeed=85;
var lineDelay=2000;
var txt="";
function ScrollIt(pos)
{
if (message.charAt(pos)!='#') {
txt+=message.charAt(pos);
pause=scrollspeed;
window.status=txt; }
else {
txt="";
pause=lineDelay;
if (pos==message.length-1) pos=-1;
}
pos++;
//status=pos;
setTimeout("ScrollIt("+pos+")",pause);
}
can anyone pls explain me this?