<!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. XTEA加密算法

    XTEA加密算法 #include <stdint.h> /* take 64 bits of data in v[0] and v[1] and 128 bits of key[0] - ...

  2. springMVC中ajax的运用于注意事项

    ajax的运用: 注意事项: dataType:"json"在ajax中可写可不写(ajax能够自动识别返回值类型),写了更加规范,可以在ajax识别错误返回值类型的时候,指定返回 ...

  3. github  安装配置以及使用遇到的一些问题

    Git是一个分布式的版本控制系统,最初由Linus Torvalds编写,用作Linux内核代码的管理.在推出后,Git在其它项目中也取得了很大成功,尤其是在Ruby社区中.目前,包括Rubinius ...

  4. Drivers Dissatisfaction

    Drivers Dissatisfaction time limit per test 4 seconds memory limit per test 256 megabytes input stan ...

  5. JPA 系列教程1-环境搭建

    JPA JPA全称Java Persistence API. JPA通过JDK 5.0注解或XML描述对象-关系表的映射关系,并将运行期的实体对象持久化到数据库中. Hibernate3.2+.Top ...

  6. Spring Boot 系列教程9-swagger-前后端分离后的标准

    前后端分离的必要 现在的趋势发展,需要把前后端开发和部署做到真正的分离 做前端的谁也不想用Maven或者Gradle作为构建工具 做后端的谁也不想要用Grunt或者Gulp作为构建工具 前后端需要通过 ...

  7. margin传递,子元素的上下margin会传递给父级

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...

  8. ios 概况了解

    iOS的系统架构分为四个层次:( iOS是基于UNIX内核,android是基于Linux内核) 核心操作系统层(Core OS layer).核心服务层(Core Services layer).媒 ...

  9. Oracle Sql优化之Merge 改写优化Update

    1.待改写语句如下 update table1 f )),) ,),)), f.jine2 )),) from table2 e where e.kjqj=f.kjqj=e.gs=f.gs and e ...

  10. Django: 之Apache、Nginx部署以及发送邮件

    在这里讲述部署的方法和常见的问题,并给出了在BAE,JAE,SAE等上面部署的实例. Django + nginx + Gunicorn/uwsgi部署方式,参见另一篇:Django部署(nginx) ...