javascript Firebug 错误:标识符在数字文字后立即启动
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5883397/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
javascript Firebug error: Identifier starts immediately after numeric literal
提问by ShadeTreeDeveloper
I've got this error being reported in firebug, but I have no idea what it means:
我在 firebug 中报告了这个错误,但我不知道它是什么意思:
Identifier starts immediately after numeric literal
标识符在数字文字之后立即开始
Here is my webpage: http://www.austintreeexperts.com/maps/optionUpdateMap.cfm?zoom=15
这是我的网页:http: //www.austintreeexperts.com/maps/optionUpdateMap.cfm?zoom =15
When the page and map loads, click on one of the blue or green markers. Then click on one of the check boxes to get the error. I have an onclick= for the input checkboxes.
当页面和地图加载时,单击蓝色或绿色标记之一。然后单击复选框之一以获取错误。我有一个 onclick= 用于输入复选框。
回答by JohnP
Your string concatenation is broken. You need to wrap your method parameters in quotes
您的字符串连接已损坏。您需要将方法参数用引号括起来
var statusForm = '<input id="tU'+Aid+'" type="checkbox" onclick="optionAUpdate(tU'+Aid+', '+color+', '+optionB+')"/> option A | <input id="iU'+Aid+'" onclick="optionBUpdate(iU'+Aid+', '+color+', '+optionA+')" type="checkbox"/> options B';
From here ----------------------------------------------------------------------------^
Corrected version
修正版
var statusForm = '<input id="tU' + Aid + '" type="checkbox" onclick="optionAUpdate(\'tU' + Aid + '\', \'' + color + '\', \'' + optionB + '\')"/> option A'
Note: I've treated all your params as strings
注意:我已将您所有的参数视为字符串
回答by JAAulde
Your onclick needs to be:
您的点击需要是:
optionAUpdate('tU20238', '75AB5F', 0)
Note that I wrapped the params in quotes as they are strings.
请注意,我将参数用引号括起来,因为它们是字符串。
回答by granticusiv
This message also appears if you've tried to name a variable starting with a numeral. eg.
如果您尝试命名以数字开头的变量,也会出现此消息。例如。
var 2ndString = 'abc';
回答by Chinthaka Dinadasa
<input
id="is-ib-checkbox"
value='+accWidgetData[count]["userAccountNumber"]+'
onchange="addaUserAccount(\'' + accWidgetData[count]["userAccountNumber"] + '\' );"
value="true"
checked="checked"
type="checkbox"
/>
回答by Gustavo
For this case, in my code:
对于这种情况,在我的代码中:
html.input()
.onclick("selectItem(" +"'"+cons.getIdentificacion().toString()+"'" + ");")
.type("radio")
.name("selectedItem")
.style("vertical-align: text-bottom")
.close();
works Fine.
工作正常。