请大家帮帮忙 问题:单机一个TextBox,要在其下面显示出一个100*200的div,而且这个div浮在所有的元素之上应该怎么实现 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <HTML> <HEAD> </HEAD> <BODY> <input type="text" onclick="if(document.getElementById('div1').style.display=='block') {document.getElementById('div1').style.display='none';} else {document.getElementById('div1').style.display='block';}"/> <div id="div1" style="width:100px; height:100px; background-color:yellow;z-index:0; display:none;"></div> </BODY></HTML> 问题:单机一个TextBox,要在其下面显示出一个100*200的div,而且这个div浮在所有的元素之上,然后点击div中某个元素,把这个元素的值赋给textbox应该怎样实现? <html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title></head><body> <form id="form1" runat="server"> <div> <input type="text" id="txtShow" onclick="if(document.getElementById('div1').style.display=='block') {document.getElementById('div1').style.display='none';} else {document.getElementById('div1').style.display='block';}"/> <div id="div1" style="width:100px; height:200px; background-color:yellow;z-index:0; display:none;"> <label id="lblValue" onclick="document.getElementById('div1').style.display='none';document.getElementById('txtShow').value=this.innerText;">显示值</label> </div> </div> </form></body></html>这个已经经过测试了, 绝对达到你的要的效果了。 上面那个没有浮在其他元素上,下面这个浮了<div> <input type="text" id="txtShow" onclick="if(document.getElementById('div1').style.display=='block') {document.getElementById('div1').style.display='none';} else {document.getElementById('div1').style.display='block';}"/> <div id="div1" style="width:100px; height:200px; background-color:yellow;z-index:0; display:none;position:fixed;"> <label id="lblValue" onclick="document.getElementById('div1').style.display='none';document.getElementById('txtShow').value=this.innerText;">显示值</label> </div> <br /> asdkfhaksdhf <br /> asdfjaskd </div> z-index设置最大 就浮动在在上面 取值的话用jquery或者js jquery插件大多可以解决,给你个网址http://www.open-open.com/ajax/jQuery.htm 自己找吧 我一般用模态窗口实现!具体见你发的另一个帖子:http://topic.csdn.net/u/20101019/11/94450083-154d-45f8-accb-b402999b2d49.html?89287 服务器中的网站Web.Config配置 Panel 关于换行的设置,wrap=false,为什么不起作用 .net引用com以及com注册的问题 JS 文件插入问题!!! 高分求教高手 请大家给出学习asp.net+C#的学习步骤,要切合实际。 有关“热门搜索”问题 求救!为应用程序池“**”提供服务的进程在与 Windows Process Activation Service 通信时出现严重错误 打印机无效 如何在asp.net的web应用中调用word?回答后马上结贴,谢谢 dropdownlist分級显示 MVC 404错误页面处理
<HTML>
<HEAD>
</HEAD> <BODY>
<input type="text" onclick="if(document.getElementById('div1').style.display=='block') {document.getElementById('div1').style.display='none';} else {document.getElementById('div1').style.display='block';}"/>
<div id="div1" style="width:100px; height:100px; background-color:yellow;z-index:0; display:none;"></div>
</BODY>
</HTML>
,然后点击div中某个元素,把这个元素的值赋给textbox
应该怎样实现?
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="text" id="txtShow" onclick="if(document.getElementById('div1').style.display=='block') {document.getElementById('div1').style.display='none';} else {document.getElementById('div1').style.display='block';}"/>
<div id="div1" style="width:100px; height:200px; background-color:yellow;z-index:0; display:none;">
<label id="lblValue" onclick="document.getElementById('div1').style.display='none';document.getElementById('txtShow').value=this.innerText;">显示值</label>
</div>
</div>
</form>
</body>
</html>
这个已经经过测试了, 绝对达到你的要的效果了。
<input type="text" id="txtShow" onclick="if(document.getElementById('div1').style.display=='block') {document.getElementById('div1').style.display='none';} else {document.getElementById('div1').style.display='block';}"/>
<div id="div1" style="width:100px; height:200px; background-color:yellow;z-index:0; display:none;position:fixed;">
<label id="lblValue" onclick="document.getElementById('div1').style.display='none';document.getElementById('txtShow').value=this.innerText;">显示值</label>
</div>
<br />
asdkfhaksdhf
<br />
asdfjaskd
</div>
我一般用模态窗口实现!具体见你发的另一个帖子:http://topic.csdn.net/u/20101019/11/94450083-154d-45f8-accb-b402999b2d49.html?89287