有麻烦使我的开始按钮转换为停止

having trouble making my start button convert to stop

本文关键字:转换 按钮 开始 麻烦 我的      更新时间:2023-09-26

这是我目前所拥有的

 <script>
 var robot = null
  }

//* *发起运动
 var moveRight = function(){
 robot.style.left = parseInt(robot.style.left) + 10 +'px';
 }
 window.onload =init;
 </script>
 </head>
 </html>
<body>

//启动按钮转换为移动

<form>
<img id = "ted" src = "Ted.png"/>
<p>Click button to move image to right</p>
<input type = "button" value = "start" onlick = "moveRight"();"/>
 </form>

这一行有一个拼写错误,语法错误:

<input type = "button" value = "start" onlick = "moveRight"();"/>

这是无效的JavaScript和属性被称为"onclick"。试试这个:

<input type="button" value="start" onclick="moveRight();" />