最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

alert text & variable JavaScript - Stack Overflow

programmeradmin9浏览0评论

Can I put both text and variable in the same alert box I thought the code down would work but it didn't

alert('text'Variable);

Can I put both text and variable in the same alert box I thought the code down would work but it didn't

alert('text'Variable);

Share Improve this question edited Jul 16, 2019 at 7:44 Vadim Kotov 8,2848 gold badges50 silver badges63 bronze badges asked Mar 22, 2017 at 9:35 user7745990user7745990 2
  • Where is Total defined? Please share your full code. – Koby Douek Commented Mar 22, 2017 at 9:36
  • 1 It WOULD work if you had defined Total somewhere – mplungjan Commented Mar 22, 2017 at 9:36
Add a ment  | 

2 Answers 2

Reset to default 8

var name = "John Doe";

function myFunction() {
  alert('Hello ' + name);
}
<button onclick="myFunction()">Checkout</button>

alert('Your text goes here'+your var goes here);

I find out the code I should have put

发布评论

评论列表(0)

  1. 暂无评论