请老师帮忙看下哪里错了
来源:3-4 编程练习
Elisa呀
2019-08-08 00:37:37
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>onload</title>
<script type="text/javascript">
windows.onload=function(){
var btn=document.getElementsByTagName("input")[0];
btn.onclick=function(){
this.style.color="red"
}
btn.onmouseout=function(){
this.style.color="gray"
}
}
</script>
</head>
<body>
<input type="button" value="点击改变按钮字体颜色" >
</body>
</html>
1回答
同学你好,是window对象,不是windows哦,多了个s。
希望能帮助到你,欢迎采纳。
祝学习愉快!
相似问题