Chrome Inspector: Uncaught SyntaxError: Unexpected token ILLEGAL

A php script is building the following (very complicated script that is too long to post here), but the chrome inspector is giving back "Uncaught SyntaxError: Unexpected token ILLEGAL". I'm having trouble finding the problem with the html below, any ideas?

<div id='580762bd48bb28c4ce3e1fafe5435969'>
    <div>There is 1 new comment on your <a href="/gci/user/aid1795">activity</a>.</div>
    <img src='/img/close.png' onclick='notificationViewed(3428, 2, 1795, 580762bd48bb28c4ce3e1fafe5435969)'></img>
</div>
</br></br>
<div id='afc89b3105b7a29d764dcebe75d2f5ef'>
    <div>There is 1 new comment on your <a href="/gci/user/aid3">activity</a>.</div>
    <img src='/img/close.png' onclick='notificationViewed(3428, 2, 3, afc89b3105b7a29d764dcebe75d2f5ef)'></img>
</div>
</br></br>
<div id='29f4b2518ab7498273466d4c584c6c2c'>
    <div>There are 2 new comments on your <a href="/gci/forecast/ifp.php?iid=269">comment</a>.</div>
    <img src='/img/close.png' onclick='notificationViewed(3428, 3, ifpgci269, 29f4b2518ab7498273466d4c584c6c2c)'></img>
</div>
</br></br>
<div id='5cbe38a820ff37f4522fc314e14b1fd6'>
    <div>There are 2 new comments on "<a href="/gci/forecast/ifp.php?iid=269">Test1</a>".</div>
    <img src='/img/close.png' onclick='notificationViewed(3428, 1, ifpgci269, 5cbe38a820ff37f4522fc314e14b1fd6)'></img>
</div>
</br></br>
</div>

你需要引用你的事件函数调用中的字符串:

 onclick='notificationViewed(3428, 1, "ifpgci269", "5cbe38a820ff37f4522fc314e14b1fd6")'

The problem is here:

onclick='notificationViewed(3428, 2, 1795, **580762bd48bb28c4ce3e1fafe5435969**)'

You wither want quote marks round that hex to make it a string, or 0x before it to signify that it is hex.


Late answer for anyone stumbling upon this question...

This particular error is not specified by Chrome, but debugging in Firefox (using Firebug) will give you more info.

链接地址: http://www.djcxy.com/p/45978.html

上一篇: Javascript错误:未捕获SyntaxError:意外的令牌非法

下一篇: Chrome Inspector:未捕获的SyntaxError:意外的令牌非法