Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/433.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript-未捕获的语法错误:意外标记<;?_Javascript_Jquery - Fatal编程技术网

Javascript-未捕获的语法错误:意外标记<;?

Javascript-未捕获的语法错误:意外标记<;?,javascript,jquery,Javascript,Jquery,Javascript: jQuery(document).ready(function() { jQuery('#submit').click(function() { jQuery("#LoadingImage").show(); var imgSrc = 'http://foo.com/gen.php?username1=' + jQuery('input[name=username1]').val() + '&amp;u

Javascript:

jQuery(document).ready(function() {
    jQuery('#submit').click(function() {         

        jQuery("#LoadingImage").show();

        var imgSrc = 'http://foo.com/gen.php?username1=' + jQuery('input[name=username1]').val() + '&amp;username2='+ jQuery('input[name=username2]').val();

        jQuery('#imgRESULT').html('<img id="image1" src="' + imgSrc + '" >');
    });

    $('#image1').on("load", (function() {
        $("#LoadingImage").hide();
    });
});
jQuery(文档).ready(函数(){
jQuery(“#提交”)。单击(函数(){
jQuery(“#LoadingImage”).show();
var imgSrc=http://foo.com/gen.php?username1='+jQuery('input[name=username1]').val()+'&;username2='+jQuery('input[name=username2]').val();
jQuery('#imgRESULT').html('');
});
$('#image1')。在(“加载”、(函数()上){
$(“#加载图像”).hide();
});
});
使用html

<div id="LoadingImage" style="display: none">
<img src.... /></div>​<div align="center" id="imgRESULT"></div>
以及正确的输入等

但进入控制台,我得到:

(未捕获的语法错误:意外标记 在function语句之前有一个额外的括号。对于外观,还将jQuery()切换为$()


在function语句之前有一个额外的括号。还将jQuery()切换为$()外观。

使用jQuery还是$无关紧要,只要jQuery没有使用noConflict。是的。对不起,我应该这么说,谢谢你的编辑!它看起来很棒。下次我会更彻底,不管使用jQuery还是$,只要jQuery没有使用noConflict。是的。对不起,我应该已经说明了这一点,感谢您的编辑!它看起来很棒。下次我会更彻底地使用文本编辑器突出显示您的代码,以便能够更快地发现您的语法错误。此外,Firebug在指出确切的语法错误方面提供了更多信息使用文本编辑器突出显示您的代码,以便能够快速发现您的语法错误另外,Firebug在指出确切的语法错误方面提供了更多信息
                        V--------------extra parenthesis
$('#image1').on("load", (function() {
    $("#LoadingImage").hide(); }); <---extra parenthesis
});
$('#image1').on("load", function() {
    $("#LoadingImage").hide();
});