<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("#searchselect").on("change",function(){
var select=$(this).val();
if(select){
if('order' == select){
$("#searchselect2").show();
$("#searchselect1").hide();
$('#span1').text();
$('#span2').text();
$("#keyWordText").val("");
}else if('product'==select){
$("#searchselect1").show();
$("#searchselect2").hide();
$('#span1').text();
$('#span2').text();
$("#keyWordText").val("");
}
}else{
$("#select").hide();
}})
});
</script>
</head>
<body>
<form id="selectform">
<select id="searchselect" >
<option value="init">PleaseSelect</option>
<option value="order">Order</option>
<option value="product">Product</option>
</select>
<p id="searchselect1" style="display: none;">
<input type="radio" value="0" id="select1" />
<span id="span1">Product CD</span> <input type="radio" value="1" id="select2" /> <span id="span2">Produce Name</span> <input id="keyWordText" type="text"> <input type="button" onClick="SelectData();" value="Search"
name="SelectData">
</p>
<p id="searchselect2" style="display: none;">
<input type="radio" value="2" id="select3" />
<span id="span3">Order ID</span> <input type="radio" value="3" id="select4" /> <span id="span4">Customer CD</span> <input id="keyWordText" type="text"> <input type="button" onClick="CustmerSearch();"
value="Search" name="CustmerSearch">
</p>
</form>
</body>
</html>
解决方案 »
- 用struts +hibernate 用一个action查询一个表出错,求解
- 急求struts1的所有.do请求使用过滤器,处理中文显示乱码
- 利用DynaBean,我可以根据不同业务动态组装parameterClass,传递给iBATIS使用。
- 请问这个题应该怎么做?
- 请问hibernate级联删除问题(两个字段关联)
- 什么是插件、构件?插件、组件、构件的区别
- package与打包成*.jar有何区别?
- 大家是如何封装ResultSet类的?
- 保险公司做一套软件,我大学还没读完无从下手,恳请大神指点下该怎么起步。
- JSP页面调用JNI问题
- Spring MVC整合sitemesh 和 zTree的问题
- hibernate级联删除的问题
$("#searchselect option:selected").val();感觉你的脚本里边错误挺多,下拉选用过click时间更合适
不好意思,我贴个效果图你看下。。
这就是选则一个option value出来的效果,点search执行两个方法中的一个。
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>使用jQuery选择器实现隔行变色</title>
<script language="javascript" type="text/javascript"
src="js/jquery-1.4.1.js"></script>
<script type="text/javascript">
$(function(){
$("#searchselect option").click(function(){
if($(this).val()=="product"){
$("#searchselect1").show();
$("#searchselect2").hide();
}if($(this).val()=="order"){
$("#searchselect1").hide();
$("#searchselect2").show();
}
});
})
function searchSelect(){
}
</script>
</head>
<body><form id="selectform">
<select id="searchselect" >
<option value="init">PleaseSelect</option>
<option value="order">Order</option>
<option value="product">Product</option>
</select>
<p id="searchselect1" style="display: none;">
<input type="radio" value="0" id="select1" />
<span id="span1">Product CD</span> <input type="radio" value="1" id="select2" /> <span id="span2">Produce Name</span> <input id="keyWordText" type="text"> <input type="button" onClick="SelectData();" value="Search"
name="SelectData">
</p>
<p id="searchselect2" style="display: none;">
<input type="radio" value="2" id="select3" />
<span id="span3">Order ID</span> <input type="radio“ value="3" id="select4" /> <span id="span4">Customer CD</span> <input id="keyWordText" type="text"> <input type="button" onClick="CustmerSearch();"
value="Search" name="CustmerSearch">
</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
</head>
<body>
<form id="selectform">
<select id="searchselect">
<option value="init">
PleaseSelect
</option>
<option value="order">
Order
</option>
<option value="product">
Product
</option>
</select>
<p id="searchselect1" style="display: none;">
<input type="radio" value="0" id="select1" />
<span id="span1">
Product CD
</span>
<input type="radio" value="1" id="select2" />
<span id="span2">
Produce Name
</span>
<input id="keyWordText" type="text">
<input type="button" value="button" onclick="fun1();" />
</p>
<p id="searchselect2" style="display: none;">
<input type="radio" value="2" id="select3" />
<span id="span3">
Order ID
</span>
<input type="radio" value="3" id="select4" />
<span id="span4">
Customer CD
</span>
<input id="keyWordText" type="text">
<input type="button" value="button" onclick="fun2();" />
</p>
<script>
$(document).ready(function() {
$("#searchselect").bind("change",
function() {
var select = $(this).val();
if (select) {
if ('order' == select) {
$("#searchselect2").show();
$("#searchselect1").hide();
$('#span1').text();
$('#span2').text();
} else if ('product' == select) {
$("#searchselect1").show();
$("#searchselect2").hide();
$('#span1').text();
$('#span2').text();
}
} else {
$("#select").hide();
}
})
});
function fun1() {
alert("fun1");
}
function fun2() {
alert("fun2");
}
</script>
</form>
</body>
</html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
</head>
<body>
<form id="selectform">
<select id="searchselect">
<option value="init">
PleaseSelect
</option>
<option value="order">
Order
</option>
<option value="product">
Product
</option>
</select>
<p id="searchselect1" style="display: none;">
<input type="radio" value="0" id="select1" />
<span id="span1">
Product CD
</span>
<input type="radio" value="1" id="select2" />
<span id="span2">
Produce Name
</span>
<input id="keyWordText" type="text">
<input type="button" value="button" onclick="fun1();" />
</p>
<p id="searchselect2" style="display: none;">
<input type="radio" value="2" id="select3" />
<span id="span3">
Order ID
</span>
<input type="radio" value="3" id="select4" />
<span id="span4">
Customer CD
</span>
<input id="keyWordText" type="text">
<input type="button" value="button" onclick="fun2();" />
</p>
<script>
$(document).ready(function() { $("#searchselect").bind("change",
function() {
var select = $(this).val();
if (select) {
if ('order' == select) {
$("#searchselect2").show();
$("#searchselect1").hide();
$('#span1').text();
$('#span2').text(); } else if ('product' == select) {
$("#searchselect1").show();
$("#searchselect2").hide();
$('#span1').text();
$('#span2').text(); } else {
$("#searchselect1").hide();
$("#searchselect2").hide();
}
} }) }); function fun1() { alert("fun1"); }
function fun2() { alert("fun2"); }
</script>
</form>
</body></html>