Javascript 未捕获的语法错误:提供给RegExp构造函数的标志无效';捕获';

Javascript 未捕获的语法错误:提供给RegExp构造函数的标志无效';捕获';,javascript,jquery,jquery-ui,javascript-events,Javascript,Jquery,Jquery Ui,Javascript Events,/assets/Capture.PNG被解释为(对于assets),而Capture.PNG作为标志-无效。您需要一个字符串:“/assets/Capture.PNG” 无论如何,您不应该使用内联事件处理程序属性——特别是当您已经有了jQuery可用时。更好: function PopImage(imagesrc,caption) { var PopupImageContainer = new Image(); PopupImageContainer.src = PopupImageSRC; s

/assets/Capture.PNG
被解释为(对于
assets
),而
Capture.PNG
作为标志-无效。您需要一个字符串:
“/assets/Capture.PNG”

无论如何,您不应该使用内联事件处理程序属性——特别是当您已经有了jQuery可用时。更好:

function PopImage(imagesrc,caption) {
var PopupImageContainer = new Image();
PopupImageContainer.src = PopupImageSRC;
setTimeout("PopupImageDisplay()",loadDelay);

}
缩略图{
光标:指针;
}

我在javascript之间错误地放置了一些代码时发生了这种情况

谢谢。。。。。在将其更改为字符串:)后,它将正常工作。。。我的意思是“/assets/Capture.PNG”您能告诉我这里的错误是什么吗…….在这一行中获取未捕获的异常错误。。。。。setTimeout(“PopupImageDisplay”(“+PopupImageContainer+”,“+PopupImageCaption+”,“+PopupImageSRC+”),loadDelay);这里也有同样的错误。查看一下您在这里生成的字符串(可能在将其输入到
setTimeout
之前提醒它),并考虑这是否有效。然后,切换到完全不使用字符串,但。我已将方法调用更改为……….setTimeout('PopupImageDisplay('+PopupImageContainer+','+PopupImageCaption+','+PopupImageSRC+'),loadDelay)。。。。但是仍然得到ssame错误。。。如果没有看到任何更改(除了不同的字符串分隔符),请更正。尝试
alert('eval(“PopupImageDisplay('+PopupImageContainer+'、'+PopupImageCaption+'、'+PopupImageSRC+'))无效”)查看出了什么问题。我的答案已经包含了解决方案——在内联JavaScript上注入后端代码时,使用一个调用
PupupImageDisplay
并带有适当参数的函数(无论如何,这是一个糟糕的做法)。
<img src="/assets/Capture.PNG" onclick="PopImage(/assets/Capture.PNG,'xyz')" style="cursor:pointer;" class="thumbnail" width="100" height="100">
function PopImage(imagesrc,caption) {
var PopupImageContainer = new Image();
PopupImageContainer.src = PopupImageSRC;
setTimeout("PopupImageDisplay()",loadDelay);

}
$("#test_point_geck_info").html('<div id="img_1" class="img_1">' +
'<img src = " + ROOT_PATH + "/assets/Capture.PNG" title="xyz" ' +
'class="thumbnail" width="100" height="100"></div>').find("img").click(PopImage);