フォームのの属性を取得する
javacriptでフォームのの属性を取得することができます。
以下のようなフォームがあったとします。

<form name="namae" method="post" action="index.do" target="_blank">
</form>
以下のボタンを押すとフォームの属性が出力されます。



以下、ソースです。

<form name="namae" method="post" action="index.do" target="_blank" />
<input type="button" value="button" onclick="a();" />
</form>
<script type="text/javascript">
<!--
function a(){
	alert("form.name=" + namae.name);
	alert("form.method=" + namae.method);
	alert("form.action=" + namae.action);
	alert("form.target=" + namae.target);
}
// -->
</script>

Back to top

Information