编辑框点击获取下拉框
来源:互联网 发布:网络游戏运营数据挖掘 编辑:程序博客网 时间:2024/06/03 02:56
html xmlns="http://www.w3.org/1999/xhtml" ><head>
<title>标题页</title>
<style type="text/css">
#divlight
{float:left;width:100px
}
</style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>所属区域</td>
<td>
<input type="text" id="txtRegion" /><!---background-color: #ccffff;----->
<div id="divList" style="display: none; border: 1px solid #0000aa; overflow: hidden; height: 200px; position: absolute; ">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr ><!--background-color:lightgreen;----background-color:lightgreen;----->
<td align="left" id="tdtitle" style="cursor: hand;border-bottom:#cccccc solid 1px;" >线路选择</td>
<td align="right" id="tdClose" style="cursor: hand;border-bottom:#cccccc solid 1px;" >X </td>
</tr>
<tr>
<td>
<div style="overflow: auto; width: 100%; height: 132px; background-color: ##ffffcc;">
<div style="float:left;width:100px">
<input type="radio" name="linelight" value="总路开关" checked>总路开关
</div>
<div style="float:left;width:100px">
<input type="radio" name="linelight" value="招牌灯">招牌灯
</div>
<div style="float:left;width:100px">
<input type="radio" name="linelight" value="展示厅">展示厅
</div>
<br>
<div style="float:left;width:100px">
<input type="radio" name="linelight" value="电视" checked>电视
</div>
<div style="float:left;width:100px">
<input type="radio" name="linelight" value="办公照明2">办公照明2
</div>
<div style="float:left;width:100px">
<input type="radio" name="linelight" value="办公照明">办公照明
</div>
<br>
<div style="float:left;width:100px">
<input type="radio" name="linelight" value="电视" checked>走道
</div>
<div style="float:left;width:100px">
<input type="radio" name="linelight" value="射灯">射灯
</div>
<div style="float:left;width:100px">
<input type="radio" name="linelight" value="备用2">备用2
</div>
<br>
<div style="float:left;width:100px">
<input type="radio" name="linelight" value="墙面射灯" checked>墙面射灯
</div>
<div style="float:left;width:100px">
<input type="radio" name="linelight" value="冰箱">冰箱
</div>
<div style="float:left;width:100px">
<input type="radio" name="linelight" value="备用8">备用8
</div>
<br>
<div style="float:left;width:100px">
<input type="radio" name="linelight" value="空调" checked>空调
</div>
<div style="float:left;width:100px">
<input type="radio" name="linelight" value="备用3">备用3
</div>
<div style="float:left;width:100px">
<input type="radio" name="linelight" value="备用11">备用11
</div>
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<script LANGUAGE="JavaScript">
var oRegion = document.getElementById("txtRegion"); //需要弹出下拉列表的文本框
var oDivList = document.getElementById("divList"); //要弹出的下拉列表
var oClose = document.getElementById("tdClose"); //关闭div的单元格,也可使用按钮实现
var colOptions = document.getElementsByTagName("input"); //所有列表元素
var bNoAdjusted = true;
oClose.onclick = function()
{
oDivList.style.display = "none"; //隐藏div,实现关闭下拉框的效果
};
//设置下列选择项的一些事件
for (var i=0; i<colOptions.length; i++)
{
if(colOptions[i].name == "linelight")
{
colOptions[i].style.cursor = "hand";
colOptions[i].onclick = function() //为列表项添加单击事件
{
oRegion.value = this.value; //显示选择的文本;
};
}
}
//文本获得焦点时的事件
oRegion.onfocus = function()
{
oDivList.style.display = "block";
if (bNoAdjusted) //控制div是否已经显示的变量
{
bNoAdjusted = false;
//设置下拉列表的宽度和位置
oDivList.style.width = 350;//this.offsetWidth+150;
oDivList.style.posTop = oDivList.offsetTop;// + this.offsetHeight;
oDivList.style.posLeft = oDivList.offsetLeft;// - this.offsetWidth - 8 + 200;
}
};
</script>
</body>
</html>
0 0
- 编辑框点击获取下拉框
- 点击变input编辑内容,点击变下拉框
- 可编辑下拉框
- 可编辑下拉框
- 可编辑下拉框
- 可编辑下拉框
- 可编辑下拉框
- 可编辑下拉框
- 页面中的点击下拉框中获取数据
- 点击下拉框跳转
- 点击弹出下拉框
- 可编辑下拉框:neverCombox
- 可编辑下拉列表框
- 可编辑的下拉框
- 可编辑的下拉框
- 实现下拉框可编辑
- 下拉框禁止编辑权限
- 下拉选择框可编辑
- 如何利用spring动态切换数据源?
- 开源项目SlidingMenu和ActionBarSherlock结合使用
- PHP在Windows下安装配置第一步
- ios UISegmentedControl 用法 【转】
- asp.net中,在.ashx文件中使用Session
- 编辑框点击获取下拉框
- 项目管理-css
- 全面深入JavaScript OOP面向对象编程
- SQLSERVER排查CPU占用高的情况
- AFNetworking2.0
- 关于一个技术上很细微,却TM很傻13的小细节——PS,第一篇博文
- Android开启闪光灯的几种办法
- 最长子序列
- QQ和微信语音音量分析