Uncaught SyntaxError:提供给RegExp构造函数’Capture’的无效标志

$("#test_point_geck_info") .html("
" + "
");

浏览器上的结果如下:

  

正在调用的函数:

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

/assets/Capture.PNG被解释为带有Capture.PNG作为标志的正则表达式文字 (用于assets ) – 这些都是无效的。 你想要一个字符串: '/assets/Capture.PNG'

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

 $("#test_point_geck_info").html('
' + '
').find("img").click(PopImage);
 function PopImage(e) { var imagesrc = this.src, caption = this.title; var PopupImageContainer = new Image(); PopupImageContainer.src = PopupImageSRC; PopupImageContainer.onload = function() { PopupImageDisplay(PopupImageContainer, PopupImageCaption, PopupImageSRC); }; } 
 .thumbnail { cursor: pointer; } 

当我在javascript之间错误地放置一些代码时,它发生了