这是我目前所拥有的
<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();" />