开发者

I ran out of available quote symbols in javascript!

开发者 https://www.devze.com 2023-01-04 06:40 出处:网络
开发者_开发技巧I can\'t believe it, but this is really happening. I ran out of available quote symbols using jquery and javascript native functions together. Can somebody help? Maybe there is yet anot

开发者_开发技巧I can't believe it, but this is really happening. I ran out of available quote symbols using jquery and javascript native functions together. Can somebody help? Maybe there is yet another symbol?

var t=setTimeout('$("#popupChange").html('<img src="http://servername/pdf/picture/genericThrobber.gif" />');',2000);

EDIT: Firebug messages about "missing ) after argument list" error.


Escaping them using \' should work.

var t=setTimeout('$("#popupChange")
.html(\'<img src="http://servername/pdf/picture/genericThrobber.gif" />\');',
2000);

(added line breaks to get rid of the scroll bar)

you could also pass an anonymous function instead of a string:

var t=setTimeout(function() { $("#popupChange")
.html('<img src="http://servername/pdf/picture/genericThrobber.gif" />');},
2000); 

should be fine either way.


You need to escape the characters using a backslash.

On the inner ', make it \'

0

精彩评论

暂无评论...
验证码 换一张
取 消