我想提醒“正在运行的功能加农炮”,然后按“确定”时,我只想说“加农炮船驶向14度角”,但它会在我的输出中不断显示提醒。
JS
function alertMessage (message) {
alert (message);
}
alertMessage("the Battle has begun");
function alertShip (ship, number) {
alert (ship);
document.write (ship + "the ship sails off to " + number + "degrees");
}
alertShip("running function cannons", 14);
的HTML
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Functions</title>
<!-- This links to the js code specific for this page -->
<script src="functions.js"></script>
</head>
<body>
<div id="output"> </div>
<div id="output2"> </div>
</body>
</html>
不要给他们相同的变量来输出.. alert(ship),然后document.write(ship + ...)。试试这个
function alertShip (ship, number) {
alert (ship);
document.write ("Cannon ship sails off to " + number + "degrees");
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句