<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript">
function btn(){
var fruit=prompt("你喜欢什么水果")
if(fruit==香蕉)
{document.write("排毒加养颜")}
else if(fruit==苹果)
{document.write("水分含量高美容")}
else
{document.write("要多吃水果哦")}
}
</script>
</head>
<body>
<input type="button" onclick="btn()" value="按钮"/>
</body>
</html>
谢谢!
香蕉 苹果 是字符串 需要加“”,