请老师检查 谢谢
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>全选和反选</title>
</head>
<body>
<input type="button" value="全选">
<script type="text/javascript">
var inputValue=document.getElementsByTagName("input")[0];
console.log(inputValue.getAttribute("value"));
function changeTo(){
if(this.getAttribute("value")=="全选"){
this.setAttribute("value","反选");
console.log(inputValue.getAttribute("value"));
}else if(this.getAttribute("value")=="反选"){
this.setAttribute("value","全选");
console.log(inputValue.getAttribute("value"));
}
}
// 老师这里怎么变成绿色的了?
function changeToBack(){
if(this.value=="全选"){
this.value="反选";
}else if(this.value=="反选"){
this.value="全选";
}
}
inputValue.onclick=changeToBack;
</script>
</body>
</html>7
收起
正在回答
2回答
同学你好,这个跟使用的编辑器主题有关系,老师这边测试函数名都是绿色的,这个函数名的颜色是没有影响的,老师测试效果如下:

祝学习愉快!

恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星