代码有些乱,但调试过是可以用的.希望对别人有所帮助.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="style.css" rel="stylesheet" type="text/css">
<title>新用户</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.textbox {font-size: 14px; color: #000033; background-color: #FFFFFF; border: 1px #000066 double}
.style1 {color: #FFFFFF}
-->
</style>
</head>
<script langauge="javascript">
var showed=0;
var clickfrom =0;// 0- document 1- other
function CheckDep( DepName )
{
theform.textfield.value = DepName;
//pDepName.rows[0].cells[0].innerText =" "+ DepName;
eval(DepLayer).style.display ="none";
}
function ShowDep()
{
if (showed==0)
{
clickfrom=1;
eval(DepLayer).style.display=';
showed=1;
}
else if ( showed==1 )
{
eval(DepLayer).style.display ="none";
showed=0;
}
}
document.onclick = OnClick;
function OnClick()
{
//
if ( showed == 1 )
{
if ( clickfrom ==1 )
{
clickfrom =0;
return;
}
eval(DepLayer).style.display ="none";
showed=0;
}
}
function ChangeColor( type,obj ) //0- mouseover 1-mouseout
{
if ( type ==0 )
{
obj.style.background='#000066';
obj.style.color ='#ffffff';
}
else
{
obj.style.background='#ffffff';
obj.style.color ='#000000';
}
}
</script>
<body width="600" border="0" oncontextmenu="return false" scroll=no>
<form action="useradd.asp" method="post" name="theform" enctype="multipart/form-data">
<table width="100%" height="" border="0" cellpadding="0" cellspacing="0">
<tr>
<td >部 门:
<input name="textfield" type="text" onClick="ShowDep()" value="-" size="30" readonly="true" >
<div id="Layer1" style="position:absolute; left:270px; top:3px; width:16px; height:13px; z-index:2;"><a href="#" onClick="ShowDep()"><img alt="用层实现带横向滚动条的下拉框" src=http://www.3pcode.com/article/article_112/combo.gif width="16" height="16" border="0"></a></div>
<div id="DepLayer" name="DepLayer" style="position:absolute; left:65px; top:20px; width:221px; height:163px; z-index:1; overflow: scroll; background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 1px none #000000;display:none" >
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#D4D0C8">
<tr>
<td>
<table border="0">
<tr >
<td onMouseOver="ChangeColor(0,this)" onMouseOut="ChangeColor(1,this)" style="CURSOR: hand">-</td>
</tr>
<tr >
<a href="#" onClick="CheckDep('一薰一莸')"><td onMouseOver="ChangeColor(0,this)" onMouseOut="ChangeColor(1,this)" style=" cursor:default">一薰一莸</td></a>
</tr>
<tr >
<a href="#" onClick="CheckDep('二百五')"><td onMouseOver="ChangeColor(0,this)" onMouseOut="ChangeColor(1,this)" style="CURSOR: hand">二百五</td></a>
</tr>
<tr >
<a href="#" onClick="CheckDep('三七二十一')"><td onMouseOver="ChangeColor(0,this)" onMouseOut="ChangeColor(1,this)" style=" cursor:default">三七二十一</td></a>
</tr>
<tr >
<a href="#" onClick="CheckDep('四通')"><td onMouseOver="ChangeColor(0,this)" onMouseOut="ChangeColor(1,this)" style=" cursor:default">四通</td></a>
</tr>
<tr >
<a href="#" onClick="CheckDep('五劳七伤')"><td onMouseOver="ChangeColor(0,this)" onMouseOut="ChangeColor(1,this)" style=" cursor:default">五劳七伤</td></a>
</tr>
<tr >
<a href="#" onClick="CheckDep('六尺之孤')"><td onMouseOver="ChangeColor(0,this)" onMouseOut="ChangeColor(1,this)" style=" cursor:default">六尺之孤</td></a>
</tr>
<tr >
<a href="#" onClick="CheckDep('一二三四五六七一二三四五六七一二三四五六七一二三四五六七')"><td onMouseOver="ChangeColor(0,this)" onMouseOut="ChangeColor(1,this)" style=" cursor:default">fffffffffffffffffffffffffffffffffffffffffffffffffffff</td></a>
</tr>
</table></td>
</tr>
</table>
</div></td>
</tr>
</table>
</form>
</body>
</html>