我无法执行此代码。我尝试了很多次但都没有成功。
<html>
<head><title>
alvin</title>
<script type = "text/javascript">
var voting age = window.prompt("please enter your age");
if(voting age>=18)
{
document.write("you are eligible to vote");
}
else
{
document.write("you are not eligible to vote");
}
</script>
</head>
</html>
答案 0 :(得分:0)
冷静下来的孩子不要在考试紧张中做饭,你唯一需要知道的是变量没有空间所以我只是用voting age
替换voting_age
<html>
<head><title>
alvin</title>
<script type = "text/javascript">
var voting_age = window.prompt("please enter your age");
if(voting_age>=18)
{
document.write("you are eligible to vote");
}
else
{
document.write("you are not eligible to vote");
}
</script>
</head>
</html>