比如有input框:
<input type="text" id="a" onblur="fun(this.id)">JS函数:function fun(id){
var d = document.getElementById(id);//这里获取到了该节点,怎么让该text框背景颜色改变,变红色也行。 即:background-color属性颜色}
<input type="text" id="a" onblur="fun(this.id)">JS函数:function fun(id){
var d = document.getElementById(id);//这里获取到了该节点,怎么让该text框背景颜色改变,变红色也行。 即:background-color属性颜色}
<div id='aDiv'>
<input type="text" id="a" onblur="fun(this)">
</div>
</body>
<script type="text/javascript">
function fun(obj){
obj.style.backgroundColor="#ff0000";
//这里获取到了该节点,怎么让该text框背景颜色改变,变红色也行。 即:background-color属性颜色
}</script>
</html>