私はフォームを作成しましたが、ボタンを押すだけでフォームが送信されます。Enterキーが押された場合にも、それを送信するにはどうすればいいですか?Enterを押すか送信ボタンを押してフォームを送信するには?
<form method="POST" id="form01">
<textarea name="inputBox123" id="myTextarea" style="white-space:nowrap;">
</textarea>
<input type="button" value="Submeter" onclick="myFunction()" />
</form>
<script type="text/javascript">
function myFunction(val) {
var testThis = document.getElementById("myTextarea").value;
if (testThis.indexOf("launch") > -1) {
window.location = 'http://www.cateto.weebly.com/benoit.html';
return false;
}
}
</script>
おかげで、
トム代わり<input type="button" />
を使用しての
どうもありがとう!
@TomDavies np、 '' https://www.w3schools.com/ –
ありがとう!私はそれを試みたが、それは動作しませんでした...つまり、動作しますが、以下の機能(「起動」が提出された場合、URLにリダイレクトされます)は機能しなくなります... –