var data = {"data":[{"pstid":100001,"id":"SWCX","pstx":670,"psty":109},{"pstid":100002,"id":"FWCX","pstx":830,"psty":269},{"pstid":100003,"id":"BWCX","pstx":510,"psty":189},{"pstid":100004,"id":"NBTX","pstx":192,"psty":109},{"pstid":100005,"id":"LXFS","pstx":350,"psty":269},{"pstid":1000016,"id":"CYXZ","pstx":192,"psty":29},{"pstid":100006,"id":"SWCX2","pstx":830,"psty":109},{"pstid":100007,"id":"SWCX1","pstx":510,"psty":269},{"pstid":1000015,"id":"SWCX3","pstx":350,"psty":29},{"pstid":100008,"id":"SWCX4","pstx":350,"psty":109},{"pstid":100009,"id":"LXFS2","pstx":670,"psty":189},{"pstid":100010,"id":"CYXZ2","pstx":350,"psty":189},{"pstid":100011,"id":"SWCX5","pstx":192,"psty":189},{"pstid":100012,"id":"SWCX6","pstx":510,"psty":29},{"pstid":100013,"id":"SWCX7","pstx":670,"psty":29},{"pstid":100014,"id":"SWCX8","pstx":830,"psty":29},{"pstid":100017,"id":"FWCX9","pstx":830,"psty":189},{"pstid":100018,"id":"FWCX8","pstx":510,"psty":109}]};
var obj = eval(data).data;
function init(){
console.log(obj.length);
for(var i=0;i<obj.length;i++){
//alert('"#'+ obj[i].id + '[pstid='+obj[i].pstid+']"');
//$('"#'+ obj[i].id + '[pstid='+obj[i].pstid+']"').parent().css({"position":"absolute"});
[color=red]$("#" + obj[i].id + '[pstid='+obj[i].pstid+']')[/color].css({"padding-top":"0px"});
$("#" + obj[i].id + '[pstid='+obj[i].pstid+']').parent().offset({top:(parseInt(obj[i].psty)) ,left:(parseInt(obj[i].pstx))});
}
}
以上代码报:Uncaught Error: Syntax error, unrecognized expression: "#SWCX[pstid]
解决办法:$(("#" + obj[i].id + '[pstid='+obj[i].pstid+']')),在#id外边再加一层括号即$((#id))
分享到:
相关推荐
Fatal error: Class ‘COM’ not found in XXXXXXXXX 没发现 COM 类,php代码主要是调用一些系统的信息,初想应该是php没配置好,在stackoverflow找到答案,是讨论xampp的,要延伸开来,我加了几个要点: ★ php 根...
JS错误Uncaught SyntaxError: Cannot use import statement outside a module< 分析及解决方法 错误信息: 错误分析: HTML 网页中,浏览器通过 script 标签加载 JavaScript 脚本。由于浏览器脚本的默认语言是 ...
主要介绍了Vue项目报错:Uncaught SyntaxError: Unexpected token <,在引入第三方依赖的 JS 文件时,遇到的一个问题,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
在外部使用var就报错Parse error: syntax error, unexpected T_VAR in…,例如我的出错信息: Parse error: syntax error, unexpected T_VAR in D:\Apache2.2\htdocs\shirdrn\page\p2\pageUtil.inc on line 34 我在...
本文实例讲述了JS提示:Uncaught SyntaxError: Unexpected token ILLEGAL错误的解决方法。分享给大家供大家参考,具体如下: Uncaught SyntaxError: Unexpected token ILLEGAL 未捕获的语法错误: 意想不到的非法...
控制台的提示:Uncaught SyntaxError: Unexpected token < 按照提示进入文件,再看如下图: 仔细看了看 index.html 文件,发现原本我的 JS 文件是放在 /src/utils 文件夹下的,但引入 /src 和 /static 的文件是...
lnmp Fatal error: Uncaught Error: Class 'Redis' not found-附件资源
主要介绍了JS提示:Uncaught SyntaxError:Unexpected token ) 错误的解决方法,结合实例形式分析了javascript提示此类异常的常见原因与相关解决方法,需要的朋友可以参考下
前言: 项目使用vue-cli版本2.9.3 ,vue-router...页面全白,console打印:Uncaught SyntaxError:Unexpected token < 报错截图: 经过一番折腾,初步定位问题1在经过build/webpack.prod.conf.js的chunkhash打包后的JS文
unity 打包web包报错:Uncaught SyntaxError: Unexpected token '在打包文件添加此配置文件。 <mimeMap fileExtension
主要介绍了vue-cli 打包后提交到线上出现 "Uncaught SyntaxError:Unexpected token" 报错,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
解决Fatal error Class 'Think' not found in runtime.php
主要介绍了解决执行脚本报syntax error: unexpected end of file或syntax error near unexpected token fi错误的问题,需要的朋友可以参考下
复制 php_sockets.dll 到ext目录 修改php.ini: extension=php_sockets.dll php4ts.dll php5ts.dll php_mime_magic.dll复制到C:\winnt\system32文件夹。 服务器
报错:Uncaught SyntaxError: Cannot use import statement outside a module 详解原文链接: ht
主要介绍了JQuery报错"Uncaught TypeError: Illegal invocation"的处理方法,需要的朋友可以参考下
Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>' 点开错误的文件,标注错误的地方是这样的一段代码: import {normalTime} from './timeFormat'; module....
编译程序时候老是报module "src/utils/utils.js" is not defined的错,狂问度娘也没结果 后来静下来想才尝试弄正确: 我本来的页面地址是:"src/main/welcome/welcome" 在这个页面的基础上要加载utils.js,所以按照...