直接上代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>
<input style="position: absolute; left: 10; top 10; width: 100; height: 23" type="text" value="some text" name="txt">
<select style="position: absolute; left: 10; top 10; width: 100; height: 22;clip:rect(auto auto auto 83)" name="cbo">
<option selected>1</option>
<option>2</option>
</select>
<br>
<input type="button" value="test" onclick="test()">
<script language="javascript">
function test()
{
cbo.style.clip = "rect(auto auto auto " + (txt.clientWidth - 17) + ")";
}
</script>
</body>
</html>