admin管理员组文章数量:1022603
I have a page with jquery on it. It works fine in Firefox, Chrome etc but if I load it in IE, none of the Jquery functions run, and IE's script debugger shows:
Error
A Runtime Error has occurred. Do you wish to Debug?
Line: 269
Error: Unterminated string constant
Yes No
The line in question is in my (unmodified) jquery.js that is causing the error is
style.left = ret || 0;
It also shows:
Error
A Runtime Error has occurred. Do you wish to Debug?
Line: 835
Error: Invalid argument.
Yes No
With the line in question being:
ret = style.pixelLeft + "px";
Any ideas?
EDIT:
Seems I may have been looking in the wrong place for the error. If I take this out, it works:
$(".middlebox").children("p").hide();
$(".middlebox").addClass("middlebox_closed", "fast");
I have a page with jquery on it. It works fine in Firefox, Chrome etc but if I load it in IE, none of the Jquery functions run, and IE's script debugger shows:
Error
A Runtime Error has occurred. Do you wish to Debug?
Line: 269
Error: Unterminated string constant
Yes No
The line in question is in my (unmodified) jquery.js that is causing the error is
style.left = ret || 0;
It also shows:
Error
A Runtime Error has occurred. Do you wish to Debug?
Line: 835
Error: Invalid argument.
Yes No
With the line in question being:
ret = style.pixelLeft + "px";
Any ideas?
EDIT:
Seems I may have been looking in the wrong place for the error. If I take this out, it works:
$(".middlebox").children("p").hide();
$(".middlebox").addClass("middlebox_closed", "fast");
Share
Improve this question
edited Sep 16, 2009 at 9:55
Oli
asked Sep 16, 2009 at 9:39
OliOli
1,0037 silver badges17 bronze badges
2 Answers
Reset to default 4The error is not necessarily in the jQuery code, but the argument value being passed as a parameter into a function in jQuery i.e. the step before.
EDIT:
This line is incorrect
$(".middlebox").addClass("middlebox_closed", "fast");
addClass()
does not take 2 arguments, just one which is a string for the class that you wish to add. Change it to
$(".middlebox").addClass("middlebox_closed");
and it will work. Or maybe you wanted to add 2 classes, in which case this will work too
$(".middlebox").addClass("middlebox_closed").addClass("fast");
// or this for brevity
$(".middlebox").addClass("middlebox_closed fast");
- (maybe) Try using style.left instead of pixelLeft Also check that style is initialised properly.
- What are you trying to achieve by this line? style.left = ret || 0; Maybe you wanted something like style.left = parseInt(ret)
I have a page with jquery on it. It works fine in Firefox, Chrome etc but if I load it in IE, none of the Jquery functions run, and IE's script debugger shows:
Error
A Runtime Error has occurred. Do you wish to Debug?
Line: 269
Error: Unterminated string constant
Yes No
The line in question is in my (unmodified) jquery.js that is causing the error is
style.left = ret || 0;
It also shows:
Error
A Runtime Error has occurred. Do you wish to Debug?
Line: 835
Error: Invalid argument.
Yes No
With the line in question being:
ret = style.pixelLeft + "px";
Any ideas?
EDIT:
Seems I may have been looking in the wrong place for the error. If I take this out, it works:
$(".middlebox").children("p").hide();
$(".middlebox").addClass("middlebox_closed", "fast");
I have a page with jquery on it. It works fine in Firefox, Chrome etc but if I load it in IE, none of the Jquery functions run, and IE's script debugger shows:
Error
A Runtime Error has occurred. Do you wish to Debug?
Line: 269
Error: Unterminated string constant
Yes No
The line in question is in my (unmodified) jquery.js that is causing the error is
style.left = ret || 0;
It also shows:
Error
A Runtime Error has occurred. Do you wish to Debug?
Line: 835
Error: Invalid argument.
Yes No
With the line in question being:
ret = style.pixelLeft + "px";
Any ideas?
EDIT:
Seems I may have been looking in the wrong place for the error. If I take this out, it works:
$(".middlebox").children("p").hide();
$(".middlebox").addClass("middlebox_closed", "fast");
Share
Improve this question
edited Sep 16, 2009 at 9:55
Oli
asked Sep 16, 2009 at 9:39
OliOli
1,0037 silver badges17 bronze badges
2 Answers
Reset to default 4The error is not necessarily in the jQuery code, but the argument value being passed as a parameter into a function in jQuery i.e. the step before.
EDIT:
This line is incorrect
$(".middlebox").addClass("middlebox_closed", "fast");
addClass()
does not take 2 arguments, just one which is a string for the class that you wish to add. Change it to
$(".middlebox").addClass("middlebox_closed");
and it will work. Or maybe you wanted to add 2 classes, in which case this will work too
$(".middlebox").addClass("middlebox_closed").addClass("fast");
// or this for brevity
$(".middlebox").addClass("middlebox_closed fast");
- (maybe) Try using style.left instead of pixelLeft Also check that style is initialised properly.
- What are you trying to achieve by this line? style.left = ret || 0; Maybe you wanted something like style.left = parseInt(ret)
本文标签: javascriptJqueryUnterminated String ConstantStack Overflow
版权声明:本文标题:javascript - Jquery - Unterminated String Constant - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745512731a2153899.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论