lz要测试一下看是哪一步出了问题啊。你的代码我们没法测试。你看看是否得到了user_namepy这个对象。如果没有建议考虑使用<html:text styleId="myId"/> ,然后在js中document.getElementById("myId");得到。如果得到了看看你的trimString函数是否正确返回。
解决方案 »
- 求助,如何使用js删除行,效果如下图所示
- 我有二个CSS文件,根据不同屏幕,使用JS如何来控制它导入呢?
- 谁有extjs下拉菜,支持模糊搜索的,显示菜单是多列的?
- JavaScript连接数据库,能连接,执行没结果
- javascript 原型问题
- 如何移动某一元素的属性?
- 选下拉框时,清空文本框
- 如何使用javascript将某网址写入客户端,感谢!
- 100分,如何做点击右键表格单元格的任意位置弹出自己做的菜单!!!!!
- 请问怎样实现弹出提示框,有确定和取消按钮?
- window.opener.document.getelementsbyname用法不对吗?
- 原始文件已经修改,但是刷新链接没有效果
<script type="text/javascript">
function check(){
if(teamForm.playerName.value=="")//在这里,你的Form的名字应该是这样的
{
alert('球员姓名不能为空');
teamForm.playerName.focus();
return false;
}
return true;
}
</script>
<html:html lang="true">
<head>
<html:base />
<title>playerAdd</title> </head>
<body>
<html:form action="team.do?method=doAdd" method="post" focus="playerName" onsubmit="return check()">
<table border="0">
<tr>
<td>playerName:</td>
<td><html:text property="playerName" /></td>
</tr>
<tr>
<td>playerSex:</td>
<td><html:radio property="playerSex" value="M" />男<html:radio property="playerSex" value="F" />女</td>
</tr>
<tr>
<td>playerAge: </td>
<td><html:text property="playerAge"></html:text> </td>
</tr>
<tr>
<td>teamId </td>
<td>
<html:select property="teamId">
<html:options collection="teamNameList" property="teamId" labelProperty="teamName" />
</html:select> </td>
</tr>
<tr>
<td colspan="2" align="center"><html:submit /></td>
</tr>
</table>
</html:form>
</body>
</html:html>
form的名字是以数组的形式出现的了,这也是个人看法,希望对你有所帮助