实现在下拉框中选中某一项后,左边出现文本框

默认下拉框效果图:

当选择其他订购厂家的时候效果:

<script>
function show(obj)
{
    document.getElementById("other").style.display=(obj.value==0)?"":"none"
}
</script>
   <li>
                        <label>订购厂家:</label>
                        <select  name="dgcj" id="dgcj"  onchange="show(this)">
								<option value="1">南京林业养殖基地</option>
								<option value="0">其他订购厂家</option>
	                </select>
						<input name="qita" style="display:none" id="other">
                    </li>

	Integer dgcj = Integer.parseInt(request.getParameter("dgcj"));
	if (dgcj == 1 && dgcj !=null) {
		animal.set("ordering_manufacturer","南京林业养殖基地");
	}else{
		animal.set("ordering_manufacturer",request.getParameter("other"));
	}
 

如果有什么问题欢迎指出与讨论;

猜你喜欢

转载自blog.csdn.net/Xiaodongge521/article/details/83011554