代码有些乱,但调试过是可以用的.希望对别人有所帮助.
<%@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 src="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>