如何解决“标识符在数字文字之后立即开始". [英] How to solve "identifier starts immediately after numeric literal"

查看:109
本文介绍了如何解决“标识符在数字文字之后立即开始".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用javascript中的以下代码,但得到:

identifier starts immediately after numeric literal 

以下脚本(例如mcnDel="016160A1"

)出现

错误

<script>
 mcnDel="016160A1"               
 var val="<a href='javascript: void(0);' onclick='removeRow("+mcnDel+");'><img src=images/delete.png></a></a></td>"  
</script>

解决方案

您需要用引号将字符串引起来.

onclick='removeRow("+mcnDel+");'

需要成为

onclick='removeRow(\""+mcnDel+"\");'

I have tried for following code in javascript, but I get:

identifier starts immediately after numeric literal 

error is coming for following script, example mcnDel="016160A1"

<script>
 mcnDel="016160A1"               
 var val="<a href='javascript: void(0);' onclick='removeRow("+mcnDel+");'><img src=images/delete.png></a></a></td>"  
</script>

解决方案

You need to wrap the string with quotes.

onclick='removeRow("+mcnDel+");'

needs to be

onclick='removeRow(\""+mcnDel+"\");'

这篇关于如何解决“标识符在数字文字之后立即开始".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆