<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
<link rel="stylesheet" type="text/css" href="${f:url('/css/stylesheet.css')}">
<script type="text/javascript">
function add(btn) {
btn.disabled = true;
var frm = document.getElementById("form1");
frm.action += "add";
frm.submit();
}
function change(){
if (event.keyCode == 13){
alert("文字が「" + Myfm.txt.value +"」に変更されました");
}
else
return
}
function SetdefaultData(textObj,selectObj){
for(i=0;selectObj.length>i;i++){
<%--alert(frmObj.elements["deptId_test"].value);--%>
if(selectObj.options[i].value == textObj.value){
selectObj.options[i].selected = true;
<%--alert("ttt"+f.options.value);--%>
break;
}else{
selectObj.options[0].selected = true;
}
}
}
</script>
</head>
<body>
<s:form method="POST" styleId="form1">
<tiles:insert template="/WEB-INF/view/common/layout.jsp" flush="true">
<tiles:put name="content_menu" type="string">
<c:choose>
<c:when test="${id == null}">
<button onclick="add(this)">登録</button>
</c:when>
<c:otherwise>
<s:submit property="update" value="更新"/>
</c:otherwise>
</c:choose>
</tiles:put>
<tiles:put name="content" type="string">
<div id="content" class="content_scroll">
<html:errors/>
<table class="data" style="width:300px;">
<tr>
<th class="data" style="width: 100px;">ID</th>
<td class="data" style="width:150px;">
${id}<html:hidden property="id"/><html:hidden property="versionNo"/>
</td>
</tr>
<tr>
<th class="data">従業員番号</th>
<td class="data">
<html:text property="empNo" size="12" maxlength="10" errorStyleClass="error"/></td>
</tr>
<tr>
<th class="data">従業員名</th>
<td class="data">
<html:text property="empName" size="26" maxlength="20" errorStyleClass="error"/></td>
</tr>
<tr>
<th class="data">雇用日</th>
<td class="data">
<html:text property="hiredate" size="12" maxlength="10" errorStyleClass="error"/>
</td>
</tr>
<tr>
<th class="data">給与</th>
<td class="data">
<html:text property="sal" size="10" maxlength="8" errorStyleClass="error"/>
</td>
</tr>
<tr>
<th class="data">管理者ID</th>
<td class="data">
<html:text property="mgrId" size="12" maxlength="10" errorStyleClass="error"/>
</td>
</tr>
<tr>
<th class="data">部門名</th>
<td class="data">
<html:select property="deptId">
<option value=""></option>
<html:options collection="deptList" property="id" labelProperty="deptName"/>
</html:select>
</td>
<html:text property="deptId_test" size="12" maxlength="10" onkeydown="SetdefaultData(this.form.elements['deptId_test'],document.getElementById('testID'))" onkeyup="SetdefaultData(this.form.elements['deptId_test'],document.getElementById('testID'))"/>
</tr>
<tr>
<th class="data">SELECT OPTION</th>
<td class="data">
<html:select property="testID">
<option value="C"></option>
<html:options collection="testList" property="KeyData" labelProperty="ValData"/>
</html:select>
</td>
</tr>
</table>
<html:hidden property="versionNo"/>
</div>
</tiles:put>
</tiles:insert>
</s:form>
</body>
</html>
分享到:
相关推荐
jquery获得select option值
select option 自定义图片的js 、css 以及代码展示,javaScript ;
1.动态创建select 代码如下: function createSelect(){ var mySelect = document.createElement(“select”); mySelect.id = “mySelect”; document.body.appendChild(mySelect); } 2.添加选项option 代码如下: ...
javascript 获取select ->option中id、value、label属性及<option></option>中内容
两个下拉列表,用JS动态添加Select中的Option元素值
静态二级联动 js 调取数据 带有 option 值
简单的例子,点击按钮就删除掉option,也可以通过jquery加载的时候进行删除。
WDA中select option的用法
本人写的一个html页面,用js实现从数组读数据自动生成select控件
拓展知识:select标签如何传递选中option的value值与text值方法 如下所示: <select name=type onchange=show_sub(this.options[this.options.selectedIndex].value)> <option value=0>请选择主菜名</option...
如何获取select下拉框的值: 1.下拉框的option没有value属性时 代码如下: <select id=”param1″> <option>学号</option> <option>姓名</option> <option>年龄</option> </seclect> [removed] [removed] = ...
复制代码代码如下: document.getElementById(“selectid”).options.length = 0; 方法二 复制代码代码如下: document.formName.selectName.options.length = 0; 方法三 复制代码代码如下: document....
1 检测是否有选中 2.动态创建select 3.添加选项option 4.删除所有选项option 5.删除一个选项option 6.获得选项option的值......
省市区三级联动[JSON+Jquery] 用alert()方法显示选中的值 var prov=$("#selProvince option:selected"); var city=$("#selCity ... alert("省:"+prov.text()+"市:"+city.text()+" 县、区:"+dist.text());//
js 操作select和optionjs 操作select和option
Ant design vue中的a-select在动态给option赋值之后,placeholder失效
4、Webdynpro入门之Select-Option,详细讲解Select-Option在Webdynpro中的应用。
jquery获得selectoption值[文].pdf
这个文档是本人在开发学习中下的别人的资料,觉得汇总的很好,后面在工作过程中修改了一些,非常有用,尤其是前端的,基本上对select option的操作都在这里面了。有收藏价值。
去除select当中重复的option并选中当前的option