初心者の質問: window.location.hash をフォーム アクション パラメータに渡したいと思います。JavaScript呼び出しでこれを行うにはどうすればよいですか?
私の現在の非動作コードは次のとおりです。
<form method="POST"
action="j_security_check"+window.location.hash>
初心者の質問: window.location.hash をフォーム アクション パラメータに渡したいと思います。JavaScript呼び出しでこれを行うにはどうすればよいですか?
私の現在の非動作コードは次のとおりです。
<form method="POST"
action="j_security_check"+window.location.hash>
JavaScript は、何らかのイベントに基づいている必要があります。したがって、送信ボタンが押されたときなどに実行したい場合があります。
<form method="POST" action="">
<input type="submit" value="Submit" onclick="this.form.action = 'j_security_check'+window.location.hash" />
.....
<form name="hello" method="POST" action="">
Hello
</form>
<script>
document.forms.hello.action = 'j_security_check'+window.location.hash;
alert(document.forms.hello.action);
</script>