赞
踩
如何实现点击input框时达到变色效果呢?
代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<script >
function t1() {
document.getElementsByName('username')[0].style.border = '1px solid red';
}
function t2() {
document.getElementsByName('username')[0].style.border = '';
}
</script>
</head>
<body>
<h1>
onfocus onblur事件
</h1>
<p>
用户名<input type="text" name="username" onfocus="t1();" onblur="t2();" />
</p>
<p>
Email:<input type="text" name="email" />
</p>
</body>
</html>

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。