DIV显示和隐藏的问题 单击一个textbox后显示一个DIV供用户选择一个数据赋值到textbox中后隐藏该DIV,现在的问题是除单击DIV和textbox外的所有控件都要隐藏该DIV,也就是说单击DIV(选中数据除外)和textbox不隐藏DIV,其他情况都要隐藏该DIV,请大家帮我个忙吧 最好能给出代码或是例子,谢谢大家了,,, 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <!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 runat="server"> <title>無題のページ</title> <script language="javascript" type="text/javascript"> function setFunction(obj) { if(document.getElementById("selectBar").style.display == "none") { document.getElementById("selectBar").style.display = "block"; document.getElementById("t1").value =""; } else { document.getElementById("selectBar").style.display = "none"; } } function setValueToText(obj) { document.getElementById("t1").value = obj.options[obj.selectedIndex].value; document.getElementById("selectBar").style.display = "none"; } </script></head><body> <form id="form1" runat="server"> <table> <tr> <td> <input type="text" id="t1" name="test1" onclick="setFunction();" runat="server" /> </td> <td> <div id="selectBar" style="display :none;"> <select onchange="setValueToText(this);" visible="false"> <option value="1111111111111">1111111111111</option> <option value="2222222222222">2222222222222</option> <option value="3333333333333">3333333333333</option> <option value="4444444444444">4444444444444</option> <option value="5555555555555">5555555555555</option> <option value="6666666666666">6666666666666</option> <option value="7777777777777">7777777777777</option> </select> </div> </td> </tr> <tr> <td> <input type="text" id="t2" name="test1" runat="server" /> </td> </tr> </table> </form></body></html>随手做了做,你自己再看看吧` 上面的例子似乎不行,当t2获得焦点时,DIV不会隐藏,同时单击其他区域DIV没有隐藏,,上面的大哥能不能再看看 avon520 能说得更清楚些吗?最好能给出一个例子来,,谢谢了 firefox全屏问题的解决 急 用Ext JS 来实现树形结构的字典管理 v:RoundRect能否设置,使得各个角的弧度不一样 ? 【求助】UTF编码的网页无法正常显示JavaScript内的中文字符 请问能否通过javascript改变自身的outerHTML 动态弹出页面怎么做? 怎样用正则表达式判断一个字符串中不含有<&|"/ 这几个字符 如何利用javascript杀死后台进程 为什么我的提交的错误。请帮忙解决。我在线。 关于window.open的怪问题,有些机子可以开有些机子又开不了???? 一个面试遇到的JavaScript变量问题 这样的弹窗你能写出来吗?
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>無題のページ</title> <script language="javascript" type="text/javascript">
function setFunction(obj)
{
if(document.getElementById("selectBar").style.display == "none")
{
document.getElementById("selectBar").style.display = "block";
document.getElementById("t1").value ="";
}
else
{
document.getElementById("selectBar").style.display = "none";
}
}
function setValueToText(obj)
{
document.getElementById("t1").value = obj.options[obj.selectedIndex].value;
document.getElementById("selectBar").style.display = "none";
}
</script></head>
<body>
<form id="form1" runat="server">
<table>
<tr>
<td>
<input type="text" id="t1" name="test1" onclick="setFunction();" runat="server" />
</td>
<td>
<div id="selectBar" style="display :none;">
<select onchange="setValueToText(this);" visible="false">
<option value="1111111111111">1111111111111</option>
<option value="2222222222222">2222222222222</option>
<option value="3333333333333">3333333333333</option>
<option value="4444444444444">4444444444444</option>
<option value="5555555555555">5555555555555</option>
<option value="6666666666666">6666666666666</option>
<option value="7777777777777">7777777777777</option>
</select>
</div>
</td>
</tr>
<tr>
<td>
<input type="text" id="t2" name="test1" runat="server" />
</td>
</tr>
</table>
</form>
</body>
</html>
随手做了做,你自己再看看吧`