<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<input type="button" value="没怀孕">
<input type="button" value="没怀孕">
<input type="button" value="没怀孕">
<input type="button" value="没怀孕">
<input type="button" value="没怀孕">
<input type="button" value="没怀孕">

<script>
var btnObjs=document.getElementsByTagName("input");
for (var i=0;i<btnObjs.length;i++) {
btnObjs[i].onclick=function () {
for(var j=0;j<btnObjs.length;j++){
btnObjs[j].value="没怀孕";
}
this.value="怀孕了";
};
}



</script>
</body>
</html>

相关文章:

  • 2021-12-12
  • 2021-10-23
  • 2021-09-15
  • 2021-10-11
  • 2022-12-23
  • 2023-03-19
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-02
  • 2021-07-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-24
相关资源
相似解决方案