一个效果相当好的demo,有些元素定位问题,希望高手相助啦。
偶得一段代码:一个input和一个select,将select切后,只保留下列按钮部分。
就组成了一个即可以输入,又可以下拉选数据的东西啦。
现在的问题:input的定位是absolute的,select也是absolute,这样用起来很不方便,如何能让input不设置位置,select通过input的id获得input的位置,用这样的方式将两者关联起来呢?
关于改变元素位置那块,实在让人头晕,希望您能把我完善下这个demo啦,最好支持IE和FF。再次感谢 :)
============
<html>
<head>
</head>
<body>
<select name= "select "style= "position:absolute;left:10px;top:10px;width:120px;height:18px; clip:rect(2 120 19 101) " id= "select " onchange= "textfield.value=select.value;textfield.select() ">
<option value= "a "> a </option>
<option value= "aa "> aa </option>
<option value= "b "> b </option>
</select>
<input type= "text " style= "position:absolute;left:10px;top:10px;width: 100px; height: 20px " name= "textfield ">
</body>
</html>
------解决方案--------------------不好弄
------解决方案--------------------改成以下这个样子,俺已经尽力了,但还不是很完美!
42 和 72 仍然是经验数据,有待高手改进!
<html>
<head>
</head>
<body>
<input type= "text " id= " " value= "1 " /> <br />
<input type= "text " id= " " value= "2 " /> <br />
<input type= "text " id= " " value= "3 " /> <br />
<table border= "0 ">
<tr>
<td>
<input type= "text " style= "width: 100px; " name= "textfield ">
<select name= "select " style= "position:absolute; left: 42px; clip:rect(0 auto auto 72); " id= "select " onchange= "textfield.value=select.value;textfield.select() ">
<option value= "天安门 "> 天安门 </option>
<option value= "故宫 "> 故宫 </option>
<option value= "慕田峪长城 "> 慕田峪长城 </option>
</select>
</td>
</tr>
</table>
</body>
</html>
------解决方案--------------------哈哈,可以了
<html>
<head>
</head>
<body>
<input type= "text " id= " " value= "1 " /> <br />
<input type= "text " id= " " value= "2 " /> <br />
<input type= "text " id= " " value= "3 " /> <br />
<table border= "1 ">
<tr>
<td style= "width:200 ">
<span>
<input type= "text " style= "width: 100px; " name= "textfield ">
<span style= "margin-left:-80;margin-top:1;width: 120px;position:absolute; left: auto;top:auto;clip:rect(0 auto auto 72); ">
<selec