日期:2014-05-16  浏览次数:20376 次

一个简单的问题,缺少 ‘)’
<script language="javascript">
jsonrpc = new JSONRpcClient("../JSON-RPC");
var result = jsonrpc.ajax.getTeam(HttpServletRequest request, HttpServletResponse response);
if (result==null) alert("vvvvvvv");
for (var i=0;i<result.length;i++){
option=document.createElement("OPTION");
option.value = result[i][0];
option.text = result[i][1];
document.all.team.options.add(option);
}


</script>

运行时提示缺少 ‘)’ 大虾们看看是怎么回事?

------解决方案--------------------
问题在
var result = jsonrpc.ajax.getTeam(HttpServletRequest.request, HttpServletResponse.response); 
的:
HttpServletRequest request

HttpServletResponse response

下面正常
HTML code

<select id=team name=team></select>
<script language="javascript">
<!--
//jsonrpc = new JSONRpcClient("../JSON-RPC"); 
//var result = jsonrpc.ajax.getTeam(HttpServletRequest.request, HttpServletResponse.response); 
var result=[
["1",1],
["2",2],
["3",3],
["4",4]
]
if (result==null) alert("vvvvvvv"); 
for (var i=0;i <result.length;i++){ 
option=document.createElement("OPTION"); 
option.value = result[i][0]; 
option.text = result[i][1]; 
document.all.team.options.add(option); 
} 

//-->
</script>