如何获得文本框的属性值,急!!!
<link rel= "stylesheet " href= "test.css ">
<style type= "text/css ">
.test {
height: auto;
width: auto;
border: 1px solid #0099FF;
background-color: #99FF00;
margin: 0px;
padding: 0px;
}
</style>
<form name= "form1 " action=test.asp method= "post ">
<table border=1>
<tr>
<td>
input type=text name=number class= "test " onfocus= "this.style.backgroundColor= '#99FF00 ';alert(this.style.backgroundColor); ">
</td>
</tr>
</table>
如果焦点在文本框上,弹出框显示“#99FF00”,但是如果onfocus变为“alert(this.style.backgroundColor); ",而弹出框显示空。为什么啊?
------解决方案--------------------alert(this.currentStyle.backgroundColor); "