JS中参数类型问题

123

function qiehuan(num){
for(var id = 0;id<=9;id++)
{
if(id==parseInt(num))
{
id=id.toString();
document.getElementById("mynav"+id).className="nav_on";
}
else
{
id=id.toString();
document.getElementById("mynav"+id).className="";
}
}
}
[color=red]报错:2010-01-22 16:20:46 [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/huigou].[action]]-[ERROR] Servlet.service() for servlet action threw exception
javax.servlet.jsp.el.ELException: The "." operator was supplied with an index value of type "java.lang.String" to be applied to a List or array, but that value cannot be converted to an integer.[/color]

[quote]shoptypelist是个根据表搜索的list,name是表的属性
list shoptypelist = this.shopService.getProperty(String,Object); [/quote]

还是不明白,,为什么不是写成${each.name}

这个不关JS的事。
就是页面中JSTL表达式出错。。
${index.count}可能错误在这里,

你的el表达式有问题导致的异常
${index.count} 这个index是个什么类型的?

换个名称试试,比如status

感觉取名字可能有关,改为

试试

shoptypelist,被期望为一个数组或List,你给了字符串?

你确定下shoptypelist这玩意是不是list类型的,

最好把源代码放上来

没看明白这句${shoptypelist.name}

shoptypelist不是list或者数组吧?

问题在这... id="mynav${index.count}"

mynav是个字符串 ${index.count}是个number类型的..

楼上正解, 应该写成${each.name} 而不是${shoptypelist.name}