jQueryを使用する場合、次のように設定できます。
フォームフォーム:
<form name = "myform" id = "myform" action = "ssss" method = "post" onsubmit = "geturl();">
JavaScriptメソッド:
<script type = "text/javascript"> function geturl(){$( 'form')。attr( 'action'、 'new_url'); } </script>または、簡単なJavaScriptを使用してください。
function test1(){alert(document.myform.action); // return値:http:// localhost:8080/xxx/ssss alert(document.myform.attributes ["action"]。値); //戻り値:ssssは以前の行とは異なります。 document.myform.action = 'new_url'; document.myform.attributes ["action"]。value = 'new_url';}フォームフォームのアクション属性の値を動的に設定する上記の簡単な方法は、私があなたと共有するすべてのコンテンツです。参照を提供できることを願っています。wulin.comをもっとサポートできることを願っています。