<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<cabeça>
<title>Documento sem título</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<estilo>
/* Documento CSS */
/* para input_dropMenu*/
corpo{
altura da linha: 10px;
BARRA DE ROLO-FACE-COR: #eeeedd;
COR DE DESTAQUE DA BARRA DE ROLAGEM: #eeeedd;
COR DA SOMBRA DA BARRA DE ROLAGEM: #666677;
BARRA DE ROLAGEM-3DLIGHT-COLOR: #666677;
COR DA SETA DA BARRA DE ROLAGEM: #666677;
BARRA DE ROLAGEM-TRACK-COR: #efefef;
SCROLLBAR-DARKSHADOW-COR: #eeeedd;
}
div{
tamanho da fonte: 9pt;
}
.dropMenu{
estouro:automático;
overflow-x:visível;
altura:100%;
borda superior: 1px sólido #aaaabb;
borda esquerda: 1px sólido #aaaabb;
borda direita: 1px sólido #666677;
borda inferior: 2px sólido #666677;
cor de fundo:#fdfdfd;
FILTER:progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=white,endColorStr=#eeeedd);
espaço em branco:nowrap;
}
.dropMenudiv{
cursor: Padrão;
cor:#666677;
preenchimento:1px 2px 1px 2px;
preenchimento superior: 2px;
script1:expressão(
onmouseover=função(){
this.style.background="#0A246A"
this.style.fontWeight = "normal"
this.style.color = "branco"
this.style.paddingLeft="3px"
},
onmouseout=função(){
this.style.background = "nenhum"
this.style.fontWeight = "normal"
this.style.color="#666677"
this.style.paddingLeft="2px"
},
onclick=função(){
escolha_dropMenu(this.parentNode.style.parent1,this)
}
);
}
</estilo>
</head>
<linguagem script="JavaScript">
// Documento JavaScript
/*
=== para input_dropMenu ===
=== gotCode 2004-9-21 ===
*/
função desenharShadowDiv(){
sDiv = '<div id="shadowDiv" '+
'estilo="'+
'posição:absoluta;'+
'esquerda:0px;topo:0px;'+
'índice z:1;'+
'cor de fundo:#2C6C85;'+
'cor de fundo da camada:#2C6C85;'+
'exibir: nenhum;'+
'FILTER:progid:DXImageTransform.Microsoft.Alpha(style=1,opacity=10,finishOpacity=20,startX=0,finishX=0,startY=0,finishY=100);'+
'borda:1px azul celeste sólido;'+
'"></div>'
documento.write(sDiv)
}
drawShadowDiv()
giveItShaow( which , sDiv ,type ){
if(tipo == "mostrar" ){
sDiv.style.zIndex = which.style.zIndex
sDiv.style.left = which.offsetLeft + which.parentNode.offsetLeft + 2;
sDiv.style.top = which.offsetTop + which.parentNode.offsetTop + 3;
sDiv.style.width = which.offsetWidth;
sDiv.style.height = which.offsetHeight;
sDiv.style.display = "";
}outro{
sDiv.style.display = "nenhum"
sDiv.style.zIndex = 1
}
}
//===显示下拉框===
/*
current_dropMenu = ID do nome do usuário
close_dropMenu = 是否可以关闭下拉框
dropMenuGo = setTimeout
*/
var current_dropMenu = null
var close_dropMenu = verdadeiro
var dropMenuGo =
função nula show_dropMenu( qual ){
current_dropMenu = qual
if(dropMenuGo!= null){
clearTimeout(dropMenuGo)
}
//info.innerText=qual.style.script1
eval("outSide_"+qual.id).style.display = ""
qual.style.display = ""
qual.scrollTop = 0
marginTop = parseInt(qual.style.marginTop)
if(margemTop < -3){
which.style.marginTop = marginTop + Math.round(( 0 - marginTop )/3)
}else if( marginTop >= -3 && marginTop < 0 ){
qual.estilo.marginTop = marginTop + 1
}
if(margemTop >= 0){
clearTimeout(dropMenuGo)
giveItShaow(qual,shadowDiv,'mostrar')
retornar
}
dropMenuGo = setTimeout("show_dropMenu( "+qual.id+" )",10) //
}
//===隐藏下拉框===
função hide_dropMenu(){
if( current_dropMenu != null ){
if(close_dropMenu){
clearTimeout(dropMenuGo)
current_dropMenu.style.display = "nenhum"
eval("outSide_"+current_dropMenu.id).style.display = "nenhum"
current_dropMenu.style.marginTop = current_dropMenu.parentNode.offsetHeight*(-1)
giveItShaow(current_dropMenu,shadowDiv,'ocultar')
}
}
}
//===选择下拉框的值===
função escolha_dropMenu(qual, self){
close_dropMenu = verdadeiro
hide_dropMenu()
//eval(qual).document.body.innerText = self.innerText.substr(0,self.innerText.length-1)
eval(qual).value = self.innerText
}
//===除前后空格===
função trim(str){
if(str.substr(0,1)==" "){
str = str.substr(1)
}
if(str.substr(str.length-1,1)==" "){
str = str.substr(0,str.comprimento-2)
}
retornar string
}
função substituirFiltros( str ){
//str = str.replace(/ /g,"")
str = aparar(str)
str = str.replace(/=/g,':')
str = str.replace(/:/g,':"')
str = str.replace(/ /g,' ')
str = str.replace(/:"///g,'://')
str = str.replace(/javascript:"/g,'javascript:')
str = str.replace(/,/g,'",')
str = str + '"'
str = str.replace(/""/g,'"')
str = "{" + str + "}"
retornar string
}
/*
type = tipo
defaultVariables = 默认的值(不能为空)
*/
function setFilters(tipo,variáveispadrão){
if(filtros[tipo] == indefinido){
if(variáveis padrão == indefinido){
variáveis padrão = ""
}
eval(tipo + "=variáveis padrão")
}outro{
eval(tipo + "=filtros[tipo]" )
}
}
var getStr, cTmpStr
função Separada_Str(){
getStr = ""
for (i = 0; i < cTmpStr.length; i++){
if (cTmpStr.substr(i,1) == " " ){
cTmpStr = cTmpStr.substr(getStr.comprimento+1)
retornar getStr
}
getStr = getStr + cTmpStr.substr(i,1)
}retornar getStr
}
//===drawDropMenu===
/*
iAutoID = código de identificação
id = 输入框的值
*/
var iAutoID = 0;
função SS_drawDropMenu(filtro){
iAutoID++
if(filtro == indefinido){
filtros = {}
}outro{
eval( "filtros=" + substituirFiltros( filtro ))
}
setFilters("id", "inputFrame"+iAutoID)
setFilters("formulário", "" )
setFilters("comprimento máximo", "")
setFilters( "cItem", "没有选项" )
setFilters("valor", "")
setFilters("startColor", "branco")
setFilters("endColor", "#eeeedd" )
setFilters("onfocus", "'javascript:;'" )
setFilters("onblur", "'javascript:;'" )
setFilters("onmouseover", "'javascript:;'" )
setFilters("onmouseout", "'javascript:;'" )
setFilters("onmouseup", "'javascript:;'" )
setFilters("onmousedown", "'javascript:;'" )
setFilters("onkeyup", "'javascript:;'" )
setFilters("onkeydown", "'javascript:;'" )
setFilters("onchange", "'javascript:;'" )
if(formulário!= ""){
pai1 = formulário+"."+id
}outro{
pai1 = id
}
//---建立下拉框选项的html语句---
var itemCount //-下拉框选项的循环次数
var itemHtml = "" //-html
var dropMenuHeight = ""
var inputSize = 0 //-下拉框的高度
itemCount = cItem.split(' ').comprimento
cTmpStr = cItem
for( var i = 0 ; i < itemCount ; i++ ){
menuValue = Separar_Str()
itemHtml = itemHtml + '<div>'+menuValue+'</div>n'
if(menuValue.length > inputSize){
inputSize = menuValue.length
}
}
if(contagem de itens < 5){
dropMenuHeight = (17 * contagem de itens + 3)
}outro{
dropMenuHeight = 88
}
setFilters("tamanho", inputSize*2 )
//---fim---
oHtml='<div id="input_dropMenu'+id+'" style="display:inline;height:21px;">n'+
'<table border="0" cellpacing="0" cellpadding="0">n'+
'<tr>n'+
'<td style="font-size:9pt;border:1px preto sólido;border-right:0px;">n'+
'<input name="'+id+'" type="text" value="'+value+'" size="'+size+'" maxlength="'+maxlength+'" style="font-size:9pt;border :0px preto sólido;" '+
'onfocus=' +onfocus+
'onblur=' +onblur+
'onmouseover=' +onmouseover+
'onmouseout=' +onmouseout+
'onmouseup=' +onmouseup+
'onmousedown=' +onmousedown+
'onkeyup=' +onkeyup+
'onkeydown=' +onkeydown+
'onchange=' +onchange+
'>'+
'</td>n'+
'<td width="16px" style="font-size:9pt;border:1px preto sólido;border-left:0px;border-right:0px;">n'+
'<div estilo="'+
'família de fontes:webdings;'+
'estouro:escondido;'+
'altura:18;'+
'margem esquerda:-1px;'+
'borda:2px início sólido;'+
'FILTER:progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr='+startColor+',endColorStr='+endColor+');'+
'"'+
' onmousedown="this.style.border='2px inserção'"'+
' onmouseup="this.style.border='2px início'"'+
' onmouseover="this.style.border='2px início'"'+
' onmouseout="this.style.border='2px início'"'+
'>n'+
'<div estilo="'+
'tamanho da fonte:9pt;'+
'margem superior:-3px;'+
'margem esquerda:1px;'+
'cursor:mão;'+
'cor:#444444'+
'"'+
'onClick="show_dropMenu(dropMenu'+id+')"'+
'onmousedown="this.style.marginLeft='2px';"'+
'onmouseup="this.style.marginLeft='1px'"'+
'onselectstart="retornar falso"'+
'>6</div>n'+
'</div>n'+
'</td>n'+
'</tr>n'+
'<tr>n'+
'<td colspan="2">n'+
'<div id="outSide_dropMenu'+id+'"'+
'class="outSideDropMenu" '+
'onselectstart="retornar falso"'+
'estilo="'+
'exibir: nenhum;'+
'posição:absoluta;'+
'índice z:21;'+
'margem superior:-1px;'+
'altura:'+dropMenuHeight+'px;'+
'largura:100%;'+
'estouro:escondido;'+
'overflow-x:visível;'+
'borda:0px preto sólido;'+
'">n'+
'<div id="dropMenu'+id+'" class="dropMenu" style="margin-top:expression(this.parentNode.offsetHeight*(-1));parent1:'+parent1+'" onMouseover="close_dropMenu= falso;" onMouseout="close_dropMenu=true;">n'+
itemHtml+
'</div>n'+
'</div>n'+
'</td>n'+
'</tr>n'+
'</table>n'+
'</div>n'
documento.write(oHtml)
}
</script>
<body onMousedown="hide_dropMenu();">
<nome do formulário="form1" método="post" action="">
Melhor:
<input name="cName" type="text" id="cName" size="10">
<br>
年龄:
<input name="iAge" type="text" id="iAge" size="10">
<br>
Exemplo: <script>SS_drawDropMenu('id=kkk,form=form1,cItem=科员 科长 所长 局长')</script> <script>SS_drawDropMenu('id=kkk2,form=form1,cItem=科员 科长所长局长')</script>
<input name="dd" type="button" value="提交" onclick="alert(form1.kkk.value)">
</form>
<p> </p></body>
</html>