当前位置: 代码迷 >> Web前端 >> jQuery-option-tree联动上拉框
  详细解决方案

jQuery-option-tree联动上拉框

热度:85   发布时间:2012-08-30 09:55:54.0
jQuery-option-tree联动下拉框

挺好用的jquery实现联动下拉框:

<html>
	<head>   
		 
		<script type="text/javascript" src="jquery-1.6.2.js"></script>
		<script type="text/javascript" src="jquery.optionTree.js"></script>    
		

	</head> 

	<body>
	<h3>Demo1</h3>
		<input type="text" name="demo1" />
		<script type="text/javascript">
			$(function() {

				var option_tree = {
				   "Option 1": {"Suboption":200},
				   "Option 2": {"Suboption 2": {"Subsub 1":201, "Subsub 2":202},
							"Suboption 3": {"Subsub 3":203, "Subsub 4":204, "Subsub 5":205}
						   }
				};

				$('input[name=demo1]').optionTree(option_tree);

			});
		</script>

		<br>
		<h3>Demo2</h3>
		<input type="text" name="demo2" />
		<script type="text/javascript">
			var option_tree = {
			   "Option 1": {"Suboption":200},
			   "Option 2": {"Suboption 2": {"Subsub 1":201, "Subsub 2":202},
						"Suboption 3": {"Subsub 3":203, "Subsub 4":204, "Subsub 5":205}
					   }
			};

			var options = {empty_value: -1, choose: '...select'};

			$('input[name=demo2]').optionTree(option_tree, options)
								 ;
		</script>

	</body>
</html>

?

还有其他demo,ajax实现等参看连接:

http://code.google.com/p/jquery-option-tree/

  相关解决方案