无法让我的开始按钮转换为停止
having trouble making my start button convert to stop
这是我目前所拥有的
<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();" />
这是我目前所拥有的
<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();" />