Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/383.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。我有Firebug插件,它显示了这两个错误和代码,但我不知道如何修复它 SyntaxError:在参数列表之后缺少) window.Templates['home'] = _.template('<% if (loggedInUser == null){ %><% } %><div id="home_container"> <div id="home_title">--- is back!

我的站点上有两个错误,我认为问题在于javascript。我有Firebug插件,它显示了这两个错误和代码,但我不知道如何修复它

SyntaxError:在参数列表之后缺少)

window.Templates['home'] = _.template('<% if (loggedInUser == null){ %><% } %><div id="home_container">  <div id="home_title">--- is back!</div>  <div id="home_description">Created by music lovers, for music lovers.</div>  <div id="home_header">    <div class="home_header home_header_on"><a href="/explore">Search</a><span> all your favorites</span></div>    <div class="home_header"><a href="#">Share</a><span> songs with friends</span></div>    <div class="home_header"><a href="/trending">See </a> <span>What's </span> <span>Trending</span></div>  </div>  <div id="home_description"> --- is the best way to find and share music online</div>   <div id="home_search_container">    <form id="home_search_form">      <input id="home_search" class="large_input_text" placeholder="Search music" type="text" />      <input id="home_search_button" type="button" value="search" />      <span id="home_search_bg"></span>    </form>  </div>  <div id="home_share" class="hidden">    <div id="home_share_wrapper"> <a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="lala" data-related="----:The best place for music on the web">Tweet</a>      <div id="fb-root"></div>      <div class="fb-like" data-send="false" data-layout="button_count" data-width="95" data-show-faces="true"></div>      <g:plusone size="medium"></g:plusone>    </div>  </div>  <div class="clear"></div></div><div id="home_footer_container"></div><body background="http://www.----.com/assets/images/testbg.jpg">');
这是固定的。但是,修复window.Templates js会产生新的错误(类型错误:be未定义),如下所示。有什么想法吗

Zc.prototype.Ga=function(a){var b=a[0],c=window;c.google_unique_id?++c.google_unique_id:c.google_unique_id=1;b.cb=c.google_unique_id;this.f.U&&(P(this,"hxva",1),O(this,"cmsid",this.f.H),O(this,"vid",this.f.I));isNaN(this.f.Da)||P(this,"pod",this.f.Da);isNaN(this.f.Ea)||P(this,"ppos",this.f.Ea);isNaN(this.f.r)||P(this,"scor",this.f.r);N.prototype.Ga.call(this,a);a=window;var b=a.document.domain,d=a.document.cookie,e=a.history.length,f=a.screen,g=a.document.referrer,k=Math.round((new Date).getTime()/

在第一个示例中,您有一个'

window.Templates['home'] = _.template('<% i<snip>...span>What's
                                                             ^
window.Templates['home']=\u.template('什么是
^

这就是终止
\.template('
)中的字符串,从“是”中删除“并重试”

第二个错误是由第一个错误引起的

如果你看一下你所发布内容的结尾,突出显示的语法会提示你,由于URL中的“/”,它将其视为一条评论

<body background="http://www.----.com/assets/images/testbg.jpg">');
”);

您需要避开斜杠。

调试实际的页面输出而不是服务器端代码不是更容易吗?您是如何做到的?您是在谈论它在哪里说的吗http://----.com/assets/images/testbg.jpg?Yes,但请看第一个答案,它是正确的,只有一个引号。双斜杠可能也是一个问题,但是他们在引用后。很好,它工作得很好。很好的快速响应感谢Adam。不幸的是,这导致了两个新的错误。我现在上传它们。你发布的错误是
类型错误:be未定义
,但是你的代码中没有声明
be
,但是这个问题似乎与你原来的问题不同,所以它是我需要一个新的问题。嘿,我只是想让你知道我解决了这个问题。这是我的php文件与javascript交互的问题。我是个傻瓜,在某些文件中添加了不同的语言。例如,javascript中的常规html或php语法,反之亦然。我只是一个初学者,但谢谢你的帮助和输入你的意思是逃避刀砍?
<body background="http://www.----.com/assets/images/testbg.jpg">');