我查过原来的问题
有位高手解决了
但是我没看懂
有哪位高手详细解说一下吗?
抄来的,记得是孟子兄弟的。
<body leftmargin="50" topmargin="50">
<style>
.optionForSel {font-size:9pt}
</style>
<table cellpadding="0" cellspacing="0" border="0" width="300">
<tr>
<td id="selectLength" width="100%" style="height:20px;padding:0px;border:2px inset #404040;border-right:0px;border-bottom:1px solid #D4D0C8;font-size:9pt;">
<div id="selectedValue" style="padding:2px;border:0px;width:100%;height:20px;font-size:9pt;vertical-align:bottom"></div>
</td>
<td width="20" style="height:20px;padding:0px;border-top:2px inset #404040;border-left:0px;border-right:1px solid #D4D0C8;border-bottom:1px solid #D4D0C8;font-size:9pt">
<img src="button2.gif" width="20" height="21" border="0" id="mm" onclick="mm_Click()" align="absmiddle">
</td>
</tr>
</table>
<div id="dropdownOption" style="position:absolute;visibility:hidden;width:100%;border:1px solid #080808;z-index:1000">
<table width="100%" cellpadding="0" cellspacing="1" class="optionForSel" bgcolor="White">
<tr onmouseover="this.style.backgroundColor=#0099ff" onmouseout="this.style.backgroundColor=">
<td onclick="document.all.selectedValue.innerText=this.innerText">
<img src="copyright.gif" border="0" align="absmiddle" hspace="2"><a href="http://lucky.myrice.com">Visit1</a>
</td>
</tr>
<tr>
<td onmouseover="this.style.backgroundColor=#0099ff" onmouseout="this.style.backgroundColor="onclick="document.all.selectedValue.innerText=this.innerText">
<img src=meng1.gif border="0" align="absmiddle" hspace="2"><a href="http://lucky.myrice.com">Visit2</a>
</td>
</tr>
<tr>
<td onmouseover="this.style.backgroundColor=#0099ff" onmouseout="this.style.backgroundColor="onclick="document.all.selectedValue.innerText=this.innerText">
<img src=meng2.gif border="0" align="absmiddle" hspace="2"><a href="http://lucky.myrice.com">Visit3</a>
</td>
</tr>
</table>
</div>
<script>
function mm_Click()
{
if(document.all.dropdownOption.style.visibility == visible)
document.all.dropdownOption.style.visibility=hidden
else
document.all.dropdownOption.style.visibility=visible
}
function init(){
document.all.dropdownOption.style.width = document.all.selectLength.clientWidth + 22;
document.all.selectedValue.contentEditable = true;
var str = 0;
var strLeft = 0;
var e1 = document.all.selectLength;
while(e1.tagName != "BODY")
{
str += e1.offset
strLeft += e1.offsetLeft
e1 = e1.offsetParent
}
document.all.dropdownOption.style.top = String(str + 24) + "px";
document.all.dropdownOption.style.left = String(strLeft) + "px";
}
function clickE()
{
if(window.event.srcElement.id !=mm)
document.all.dropdownOption.style.visibility=hidden;
}
document.onclick = clickE
window.onload = init
</script>
<br>
<br>
<input onclick="alert(document.all.selectedValue.innerText)" type="button" value="得到值">
你查仔细一点
<select onchange=document.all("t1").value=this.value>
<option value="1">1
<option value="2">2
</select>
<input type="text" id="t1">
试试这个:
<select name="select" style="position:absolute; left: 197px; top: 80px; width: 120px; height: 22px; clip: rect(0 120 22 100)" id="select" onchange="clientUser.value=select.options[select.selectedIndex].text;clientUser.select()">
<option value="1" selected>aaaaaa</option>
<option value="2">bbbbb</option>
</SELECT>
<input type="text" style="position:absolute; left: 198px; top: 81px; width: 100px; height: 18px" name="clientUser" value="请选择二批名称" onfocus="this.select();">
一般是做两个并列的,一个是text,一个是select
<INPUT type="text" id=text1 name=text1>
<SELECT id=select1 name=select1 onchange="text1.value =select1.value">
<OPTION value=1>1</OPTION>
<OPTION value=2>2</OPTION>
</SELECT>
既能自己输入又能选择的下拉列表框,不实用的。