2013-06-23 53 views
0

我有以下功能JavaScript的意外標識符與谷歌Analytics(分析)

<script type="text/javascript">function downloadfunction(keyword){_gaq.push(['_trackEvent','Class1','Download',keyword])}</script> 

它將觸發當用戶點擊提交盒

type="submit" onClick = "downloadfunction(Where am I Wearing: A Global Tour to the Countries, Factories, and People That Make Our Clothes) 

然而,當這火我得到以下錯誤

意外標識符

有什麼想法爲什麼?

+0

請註明答案所接受,如果它解決您的問題。 – Pavan

回答

1

在你的第二個代碼片段中,你似乎缺少第二組雙引號。

您傳遞的字符串也需要引號。

應該更像

type="submit" onclick = "downloadfunction('Where   
am I Wearing: A Global Tour to the Countries,  
factories, and People That Make Our Clothes');"