我很确定这只是一个格式化错误,但我无法看到我做错了什么。我想在警报中制作3行。我知道我的错误与\ n的位置有关,因为当我删除它时,警报功能正常,它只是将文本包装在消息框中。
alert("Your Order Total = $" + T.toFixed(2) +
\n "Your toltal Quanity is " + cq +
\n "Thank You for your order have a wonderfull day" );
答案 0 :(得分:3)
换行符在字符串
中alert("Your Order Total = $" + T.toFixed(2) +
"\nYour total Quantity is " + cq +
"\nThank You for your order have a wonderful day" );
答案 1 :(得分:0)
alert("Your Order Total = $" + T.toFixed(2) +
"\nYour toltal Quanity is " + cq +
"\nThank You for your order have a wonderful day" );
您的代码不起作用,因为您使用\n
符号不在引号内。你必须在引号内使用它。