<!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>
<style type="text/css">
*{ margin:0px auto; padding:0px;}
#wai1{ width:100px; height:35px; border:1px solid #666; text-align:center; vertical-align:middle; line-height:35px;}
#wai1:hover{ cursor:pointer;}
.xiang{ width:100px; height:35px; text-align:center; vertical-align:middle; line-height:35px; border:1px solid #666; border-top-width:0px; display:none;}
.xiang:hover{ cursor:pointer; background-color:#0F6} </style>
</head> <body>
<br />
<div id="wai1" onclick="dianji()"></div>
<div class="xiang" onclick="xuanzhong(this)">山东</div>
<div class="xiang" onclick="xuanzhong(this)">淄博</div>
<div class="xiang" onclick="xuanzhong(this)">淄川</div>
<div class="xiang" onclick="xuanzhong(this)">张店</div>
<div class="xiang" onclick="xuanzhong(this)">桓台</div>
</body>
</html>
<script type="text/jscript"> function dianji()
{
var a = document.getElementsByClassName("xiang");
for(i=0;i<a.length;i++)
{
a[i].style.display = "block";
}
} function xuanzhong(b)
{
var c = b.innerHTML;
document.getElementById("wai1").innerHTML = c ;
var a = document.getElementsByClassName("xiang");
for(i=0;i<a.length;i++)
{
a[i].style.display = "none";
}
}
</script> <!--<style type="text/css">
*{ margin:0px auto; padding:0px}
#xiala{ width:200px; height:40px; border:1px solid #999;text-align:center; line-height:40px; vertical-align:middle;}
#xiala:hover{ cursor:pointer}
.list{ width:200px; height:40px; text-align:center; line-height:40px; vertical-align:middle; border:1px solid #999; border-top-width:0px; display:none}
.list:hover{ cursor:pointer; background-color:#63C; color:white;}
</style>
</head> <body>
<br />
<div style="width:500px; height:500px;"> <div id="xiala" onclick="showa()"></div>
<div class="list" onclick="xuan(this)">山东</div>
<div class="list" onclick="xuan(this)">北京</div>
<div class="list" onclick="xuan(this)">上海</div>
<div class="list" onclick="xuan(this)">深圳</div>
<div class="list" onclick="xuan(this)">广州</div> </div>
<script type="text/javascript">
function showa()
{
var list = document.getElementsByClassName("list");
for(var i=0; i<list.length;i++)
{
list[i].style.display = "block";
}
} function xuan(a)
{
var nr = a.innerHTML;
document.getElementById("xiala").innerHTML=nr; var list = document.getElementsByClassName("list");
for(var i=0; i<list.length;i++)
{
list[i].style.display = "none";
}
}
</script>
</body>
</html>-->

用div做下拉列表的更多相关文章

  1. 9月23日JavaScript作业----用DIV做下拉列表

    例题二.用div做下拉列表 <title>无标题文档</title> <style type="text/css"> *{ margin:0px ...

  2. JS之document例题讲解1(两张表之间数据转移、日期时间选择、子菜单下拉、用div做下拉菜单、事件总结)

    作业一:两个列表之间数据从一个列表移动到另一个列表 <div style="width:600px; height:500px; margin-top:20px"> & ...

  3. 两个重叠的div做前后翻转

    当需要做一个翻转卡片式的div时候,需要两个div的大小等大例如: 画出两个等大的div后,将他们重叠 图中的两个div做了重叠,做重叠时候用的属性是 position: absolute; 并且需要 ...

  4. 怎样用div做三角形

    20181204 用盒子模型做三角形的效果: <div></div> width:0px; height:0px; border:10px solid red; border- ...

  5. [css]display: table-cell,用div做分列布局

    table-cell我们却能用得到,而且是用它来干一件很重要的事情——多列布局. 多列布局在css中有多重要就不用我说了吧,传统模式下大家都使用float来解决这一问题,但是float写出来的东西代码 ...

  6. 学习笔记之08试用div做网页(滨院)-小作业

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  7. DIV做的Table

    <style> div.table{ border:1px solid #d7d7d7; margin-left:0px; border-bottom-width:; width:1200 ...

  8. XML做下拉列表

    5-18X.php主页面 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http: ...

  9. 用div加css做表格去掉外围边框

    通过div做表格时想加上边框,并且想取点外围边框: <div class="cont"> <div class="row"> <a ...

随机推荐

  1. error: invalid 'asm': invalid operand for code 'w'

    google 出结果 http://stackoverflow.com/questions/15623609/including-curl-into-the-android-aosp ........ ...

  2. avd

    http://stackoverflow.com/questions/2662650/making-the-android-emulator-run-faster http://www.cnblogs ...

  3. C# 截取字符串某个字符分割的最后一部分

    例如 string s1="123.456.789",想截取得到的新字符串为“789” 代码如下: string s1 = "123.456.789"; str ...

  4. git简单常用的命令

    git status --查看文件状态 git add+文件路径 --上传到缓存区 git add --all --全部传到缓存区 git commit -m '描述' --对上传文件做描述 git ...

  5. struts2中的文件上传,文件下载

    文件上传: Servlet中的文件上传回顾 前台页面 1.提交方式post 2.表单类型 multipart/form-data 3.input type=file 表单输入项 后台 apache提交 ...

  6. Jmeter的优点是什么?除了轻量级,它和LoadRunner有什么本质区别

    1.jmeter的架构和loadrunner原理一样,都是通过中间代理,监控和收集并发客户端发出的指令,把他们生成脚本,再发送到应用服务器,再监控服务器反馈结果的一个过程: 2.分布式中间代理功能在j ...

  7. linux 显示文件或文件夹

    用 -v 很简单呀! 显示文件 ls -l | grep -v '^d'显示目录 ls -l | grep '^d'

  8. offset获取位置

    <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content ...

  9. CSS3简介

    选择器 盒模型 背景和边框 文字特效 2d/3d转换 动画 多列布局 用户界面

  10. HDU 3346 Lucky Number

    水题 #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> us ...