警报弹出没有出现第二次
Alert pop up not showing up second time
我是新手javascript。
所以,我只用头文件制作了简单的 html,并用这段代码将简单的 javascript 代码文件链接到它。
警报弹出显示一次但不是第二次。
var pounds = prompt("Enter your weight in Pounds");
var kg = 0.456 * pounds;
Alert("Your weight is:" +"kg");
alert("Your weight is:"+ kg+"kg");
alert
不应大写
var pounds = prompt("Enter your weight in Pounds");
var kg = 0.456 * pounds;
alert(`Your weight is: ${kg}kg`);
您的问题只是一个错字。 In Javascript, all identifiers are case sensitive, so Alert()
is not the same thing as alert()
. (MDN link)
您在此处寻找 alert()
:
var pounds = prompt("Enter your weight in Pounds");
var kg = 0.456 * pounds;
alert("Your weight is:" + "kg");
我是新手javascript。 所以,我只用头文件制作了简单的 html,并用这段代码将简单的 javascript 代码文件链接到它。 警报弹出显示一次但不是第二次。
var pounds = prompt("Enter your weight in Pounds");
var kg = 0.456 * pounds;
Alert("Your weight is:" +"kg");
alert("Your weight is:"+ kg+"kg");
alert
不应大写
var pounds = prompt("Enter your weight in Pounds");
var kg = 0.456 * pounds;
alert(`Your weight is: ${kg}kg`);
您的问题只是一个错字。 In Javascript, all identifiers are case sensitive, so Alert()
is not the same thing as alert()
. (MDN link)
您在此处寻找 alert()
:
var pounds = prompt("Enter your weight in Pounds");
var kg = 0.456 * pounds;
alert("Your weight is:" + "kg");