0
代码片段:
var role=s[0].Role;// role contains string value
dijit.byId("editRole").attr("Value",getRoleByName(role));
function getRoleByName(role)
{
var roleVal;
alert(role);
switch(role)
{
case 'Basic User' :roleVal='1';break;
case 'Network Operator' :roleVal='3';break;
case 'System Administrator' :roleVal='5';break;
case 'Custom Level 1' :roleVal='11';break;
case 'Custom Level 2' : roleVal='12';break;
default: roleVal='1';break;
}
return roleVal;
}
当我试着打电话给其在它的switch语句,我在IE8中得到以下错误的JavaScript方法,但在FF工作正常..开关的情况下没有在IE8工作
错误在开发工具:
method Error executing: function(/*Event*/ e){
// summary:
// Handler when the user activates the button portion.
if(this._onClick(e) === false){ // returning nothing is same as true
e.preventDefault(); // needed for checkbox
} else if (this.type == "submit" && !this.focusNode.form){ // see if a nonform widget needs to be signalled
for(var node=this.domNode; node.parentNode/*#5935*/; node=node.parentNode){
var widget=dijit.byNode(node);
if(widget && typeof widget._onSubmit == "function"){
widget._onSubmit(e);
break;
}
}
}
}TypeError: Object doesn't support this property or method
谁能帮助我? ......如何解决这个问题?... 在此先感谢
问候, Kamesh
我看不到任何tidles实现... – starbeamrainbowlabs 2012-07-21 15:04:05
感谢迅速的反应mschr ......你是right..actually问题是即时通讯使用role.toString( )。修剪()。这是造成问题......但如果我删除toString转换,总是返回默认值。 – kamesh 2012-07-21 15:36:37
修剪不是一个完全原生的实现功能,虐待添加一个字符串原型扩展到我的答案然后 – mschr 2012-07-21 15:46:51