html中select的用法

我想用select加上script实现显示和隐藏的功能,比如我选择1,出现pic1,pic2隐藏。选择2出现pic2,pic1隐藏。... 我想用select加上script实现显示和隐藏的功能,比如我选择1,出现pic1,pic2隐藏。选择2出现pic2,pic1隐藏。 展开
 我来答
匿名用户
2013-05-30
展开全部
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script src="jquery-1.3.2.js"></script>
<!-- jquery-1.3.2.js 可以去 http://download.pcpop.com/Down/39992.html 下载,然后注意路径,和你文件可以放一个文件夹中-->
<style>
.pic1{ width:200px; height:100px; background:#666;}
.pic2{ width:200px; height:100px; background:#888; display:none;}
</style>
<script>
$(function(){
$("#select").click(function(){
if($("#select").select().val()=="2"){
$(".pic1").hide();
$(".pic2").show();
}else{
$(".pic2").hide();
$(".pic1").show();
}
})
})
</script>
</head>

<body>
<select id="select">
<option selected="selected">1</option>
<option>2</option>
</select>
<div class="pic1">这是pic1层</div>
<div class="pic2">这是pic2层</div>
</body>
</html>
TableDI
2024-07-18 广告
当使用VLOOKUP函数在Excel中进行数据匹配时,如果一个数据需要匹配多行数据,通常不能直接使用标准的VLOOKUP。因为VLOOKUP是基于单个键值查找并返回单个结果的。要匹配多行数据,可以采用以下几种方法:1. **数组公式**:使... 点击进入详情页
本回答由TableDI提供
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式