JS错误:Uncaught SyntaxError: Unexpected token ILLEGAL
$('tbody', '#' + tableId).append('<tr onmouseover="this.style.backgroundColor=\'#eeeeee\'">xxx</tr>');
用js的onmouseover鼠标事件动态改变背景色
如果是this.style.backgroundColor=#eeeeee
将出现Uncaught SyntaxError: Unexpected token ILLEGAL错误 未捕获的SyntaxError:意外的非法标记
如果改为this.style.backgroundColor="#eeeeee"或者this.style.backgroundColor=\"#eeeeee\"
将出现Uncaught SyntaxError: Unexpected token }错误 未捕获的SyntaxError:意外的标记 }
因为 onmouseover="this.style.backgroundColor=#eeeeee" 外面已经有一对引号了
正确的做法应该是 onmouseover="this.style.backgroundColor=\'#eeeeee\'" ,总之就是引号标记错误
还有更绕的
var s = "\""+dataObj[$(th_obj).attr('SID')]+"\"";
dataObj = "<a href='#' onMouseOver='mouseOver(this,event,"+s+");'>.....</a>"; //s是变量
在用js,jquery动态添加数据的时候 尤其注意‘ ”有时还需要转义。
JS错误:Uncaught SyntaxError: Unexpected token ILLEGAL的更多相关文章
- 前端javascript 错误 Uncaught SyntaxError: Unexpected token ILLEGAL
前端控制台报Uncaught SyntaxError: Unexpected token ILLEGAL 错误时,就是非法字符错误,首先检查符号是否正确,不要出现中文标点! 然后检查参数之类的类型是否 ...
- js报Uncaught SyntaxError: Unexpected token <错误 解决方法
js报Uncaught SyntaxError: Unexpected token <错误 解决方法 错因 js被shiro的拦截器拦下,访问不了 #shiro的配置 shiro: hash-a ...
- 记一次debug记录:Uncaught SyntaxError: Unexpected token ILLEGAL
在使用FIS3搭建项目的时候,遇到了一些问题,这里记录下. 这里是发布搭建代码: // 代码发布时 fis.media('qa') .match('*.{js,css,png}', { useHash ...
- Uncaught SyntaxError: Unexpected token ILLEGAL【js错误】
应该是逗号的中英文状态错了,应该是英文状态的逗号.还有百度应用后面的逗号.college后面的冒号
- JS缺失错误- Uncaught SyntaxError: Unexpected token <
这种情况,表明,缺少js文件 解决方式:在文件夹下将缺少js文件补足
- Uncaught SyntaxError : Unexpected token ILLEGAL js传递带空格的参数
通常在页面中要让某些内容点击后产生点击事件(非页面跳转)都会使用onclick,但是这样不适于需要传递参数的情况,于是写成直接调用JavaScript函数的方式:<a href=javascri ...
- 【JS-Java-EL】JavaScript和Java(EL表达式)引发的 Uncaught SyntaxError: Unexpected token ILLEGAL
2018.10.14 BUG原因: 在较早期的代码中,容易出现 JS 拼接 HTML 代码字符串的情况.如 // 页面 test.jsp 内部的 JS 代码 // ${} JSP中EL语法,内部为Ja ...
- Uncaught SyntaxError: Unexpected token ILLEGAL
原因,相关的JS函数中,存在一个中文逗号,修改即可正常执行
- js Uncaught SyntaxError: Unexpected token错误
今天遇到js报错Uncaught SyntaxError: Unexpected token 不知道是什么原因,并且js还会继续往下执行. 经过排查竟然是在保存行的上面有个if少一个大括号,真是坑爹啊 ...
随机推荐
- POJ 2109 :Power of Cryptography
Power of Cryptography Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 18258 Accepted: ...
- Introducing Visual Studio’s Emulator for Android
visual studio 2015支持Android开发了. Microsoft released Visual Studio 2015 Preview this week and with it ...
- IOS开发-Swift新语言初见
Safe Swift pairs increased type safety with type inference, restricts direct access to pointers, and ...
- 理解iOS软件开发框架
iOS软件开发框架理解 这个东西是硬伤,框架?自带的mvc? 自带的UIViewController UIView UINavigationController 这些算不算?当然算的,cocoa框架嘛 ...
- C语言连接Oracle
原文:C语言连接Oracle 最近在搞C语言连接Oracle.DB2数据库,现把C连接Oracle的文章总结下: 用C语言连接ORACLE数据库.有两个思路和目的 思路一)本地环境:UBUNTU 7. ...
- 推荐两个针对github的chrome插件
作为一只程序猿,在github上找代码.看代码是再正常不过的事情了.这时候有个工具可以方便你翻看代码,想必是极好的. Sourcegraph for GitHub 这个插件允许你像使用IDE那样浏览代 ...
- Ubuntu Ruby On Rails安装和配置
在这篇文章中ubuntu通过rvm安装ruby和rails.步借鉴了官方网站和网上信息,这里给大家分享. 1. 安装mapapis公钥: gpg --keyserver hkp://keys.gnup ...
- 一个极简的守护进程Bash脚本
由于最近写的Node.js程序因为一些Bug,会出现一些自动退出的问题,所以需要在它退出的时候及时发现,并重新启动 于是查阅了些资料,写了一个Bash的程序,功能十分简单,就是每隔3s判断一次处在60 ...
- 题注Oracle数据库的网络连接原理
版权声明:本文博客原创文章,博客,未经同意,不得转载.
- leetcode第33题--Search for a Range
Given a sorted array of integers, find the starting and ending position of a given target value. You ...