<form action='page.html'
method='post'>
<input type="text" name="name" placeholder="Enter your name here">
<input type="submit" value="submit">
</form>
在表單提交后的上述代碼中,將有大約 5 秒的加載螢屏或圖示(圖示更好),然后它將重定向到 page.html。我是 Web Dev 世界的新手,所以請幫助我任何人編碼部分。我不知道如何使用 javascript 或 jQuery 來做到這一點。
uj5u.com熱心網友回復:
您可以使用字體真棒微調圖示,此代碼將在輸入欄位下方顯示微調圖示 5 秒。您可以根據需要更改其位置。
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<form action='page.html' method='post' onSubmit="return showSpinner(this);">
<input type="text" name="name" placeholder="Enter your name here">
<input type="submit" value="submit">
</form>
<i class="fa fa-spinner fa-pulse" style="font-size:24px;visibility:hidden" id="spinner-icon"></i>
<script>
const showSpinner = form => {
// Display the spinner icon
document.getElementById("spinner-icon").style.visibility = "visible";
// Wait 5 seconds then submit form
setTimeout(function() {
form.submit();
}, 5000); // 5 seconds
return false;
}
</script>
</body>
</html>
uj5u.com熱心網友回復:
<form action='page.html' method='post' onsubmit="myFunction()">
<input type="text" name="name" placeholder="Enter your name here">
<input type="submit" value="submit">
</form>
<script>
function myFunction() {
alert("The form was submitted");
}
</script>
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/399005.html
標籤:javascript html 查询
