在這里,我正在嘗試制作一個 QnA 網站。所以這里是 HTML 代碼。
<!DOCTYPE html>
<html>
<head>
<title>Questions</title>
</head>
<body>
<h1>Questions</h1>
<form action="result.html" method="post" target="_blank"
onsubmit='event.preventDefault() ;sendForm1("ask-question")'
name="ask-question">
<h3>Ask a Question</h3>
<!--Adds textarea field to write a question-->
<textarea name="ask-question" rows=5 cols=25 id="your-question">Why do you want to draw art?</textarea><br>
<!--Submit button to send question to email and redirects to result.html without opening an email inbox. The problem is I have no idea how to make it send to my email.-->
<input type=submit value=Ask name=ask>
</form>
<a href="/">Go back home</a>
<br>
<p>No Questions available yet!</p>
<h2>Be the First to ask!</h2>
<h3>Type the question in the text box then click Ask</h3><a href="faq.html">or go to FAQ</a>
</body>
</html>
在這里我提出了一些關于代碼的含義,你會發現大多數問題,但主要問題是我無法讓提交按鈕作業。或者有些只是重新加載網站。這是代碼的預覽。 點擊查看代碼 html 預覽 我該如何解決這個問題?
uj5u.com熱心網友回復:
該代碼不起作用,因為您正在使用onsubmit = event.preventDefault()它阻止了表單提交的默認行為。這就是為什么您沒有被重定向到該result.html頁面的原因。洗掉event.preventDefault(),這應該可以作業
uj5u.com熱心網友回復:
我可能知道也可能不知道,但我認為這部分缺少斜線:<textarea .../>
你可以添加然后
我不知道我可能是錯的
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/439975.html
標籤:javascript html
