`
usenrong
  • 浏览: 505591 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

Jquery实现下拉框与输入框动态切换,类似可编辑的下拉框

 
阅读更多
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<script type="text/javascript" src="js/jquery.js"></script>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Language" content="<#ZC_BLOG_LANGUAGE#>" />
		<title>下拉框与输入框动态切换</title>
		<script type="text/javascript" src="js/jquery-1.6.1.js"></script>
		<script type="text/javascript">
	$(document).ready(function()
	{
		$("#changeItem").bind("click", function() {
		     var flag =   $("#inputer").is(":visible");   //判断元素显示或隐藏状态
			 $("#inputer").toggle(1,function(){ 
			    $("#selecter").toggle(flag);
			    if ( $("#changeItem").attr("value") == "下拉"){
			        $("#changeItem").val("输入") ;
			    }
			     else{
			        $("#changeItem").val("下拉") ;
			    }
			    }); 
			
			 }); 
	});
</script>
	</head>
	<body>
		<form action="">
			<table>
				<tr>
					<td>
					</td>
				</tr>
				<tr>
					<td align="left" width="190">
						<input type="text" name="inputer" id="inputer"
							style="width: 190px; height: 20px; margin: -2px;"/ >
						<select name="selecter" id="selecter"
							style="width: 190px; height: 20px; margin: -2px; display: none;">
							<option value="">
								请选择.....
							</option>
							<option value="1">
								一级领导
							</option>
							<option value="2">
								主管领导
							</option>
							<option value="3">
								一般科员
							</option>
							<option value="4">
								一般文员
							</option>
						</select>

					</td>
					<td align="left" width="190">
						<input type="button" style="" id="changeItem" value="下拉" />
					</td>
				</tr>


			</table>
		</form>

	</body>
</html>

 

分享到:
评论
1 楼 system1029hq 2011-07-05  

相关推荐

Global site tag (gtag.js) - Google Analytics