vakas
vakas

Reputation: 1817

javascript setinterval function problem

i am using this code

 <a onclick="javascript:var t=setInterval("GetUpdates(5,ajaxResult)",300);">GetUpdates</a>

but getting the syntax error

Upvotes: 1

Views: 774

Answers (1)

rahul
rahul

Reputation: 187110

Try

var t=setInterval(function(){GetUpdates(5,ajaxResult);},300);

You are including a double quote inside the onclick event handler which is causing the problem.

<a onclick="javascript:var t=setInterval(function(){GetUpdates(5,ajaxResult);},300);">GetUpdates</a>

Upvotes: 2

Related Questions