[英]Uncaught SyntaxError: Unexpected string
I'm having difficulty getting the following to work, all I get from Chrome's Console is Uncaught SyntaxError: Unexpected string
. 我很难执行以下操作,从Chrome控制台获得的所有内容都是
Uncaught SyntaxError: Unexpected string
。
I have tried tmp = event.keyCode
and changing tmp
in the if
statement to event.keyCode
but I cannot identify the problem. 我已经尝试过
tmp = event.keyCode
并将if
语句中的tmp
更改为event.keyCode
但是我无法确定问题所在。
function showSearching() { alert ("Hello World"); } $('#search').bind('keydown', function() { tmp = Number(event.keyCode); if ( ( tmp=<"48" && tmp=>"90" ) || ( tmp=<"96" && tmp=>"111" ) || ( tmp=<"186" && tmp=>"222" ) ) { showSearching(); } });
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script> <input id="search" type="text">
Wrong syntax of relational operator in if statement. if语句中关系运算符的语法错误。
change => to >=
and =< to <=
将
=> to >=
更改=> to >=
,将=< to <=
$('#search').bind('keydown', function() {
tmp = Number(event.keyCode);
if ((tmp <= "48" && tmp >= "90") || (tmp <= "96" && tmp >= "111") || (tmp <= "186" && tmp >= "222")) {
showSearching();
}
});
将=<
更改为<=
if ( ( tmp<="48" && tmp>="90" )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.