[英]Get the value of a submit button to be a condition for alert message in JavaScript
[英]alert message on button submit javascript
所以我有一個有點時髦的情況。 我在我的 static html 站點上使用表單狂歡,我想在他們單擊提交按鈕后提醒一條消息說message sent successfully
。 工作正常,但它並沒有像我希望的那樣刷新頁面。 這就是我所擁有的,我認為這行不通,但我認為這是一個不錯的起點:
function myFunction() { alert("message successfully sent").then(response => { window.location.href = 'index.html'; }) }
<div class="col-lg-12"> <input type="submit" class="btn btn-defeault btn-send" value="Send message" onclick="myFunction()"> </div>
如您所見,我想說,嘿,發送消息,然后刷新頁面。 但它沒有刷新頁面......有什么想法嗎?
用這個:
function myFunction() { alert("message successfully sent"); window.location.reload(); }
<input type="submit" class="btn btn-defeault btn-send" value="Send message" onclick="myFunction()">
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.