WEST MiRa(1,739 Byte)
JavaScript(1,601 Byte)

■ JavaScript - 基本操作 - フォームの値を取得&表示
   - 1.テキストボックスの値を取得する

テキストオブジェクトの値を取得します。

書式は、

  変数名=document.フォーム名.テキストオブジェクト名.value;

となります。

ソース
<html>
<head>
<script language="JavaScript">
<!--

function my1()
{a=document.form1.text1.value;
alert(a);}

//-->
</script>
</head>
<body>

<form name="form1">
<input type="text" name="text1"size="10">
<input type="button" value="CLICK!" onClick="my1()">
</form>

</body>
</html>
実行結果
入力欄に文字を入力してボタンをクリックしてください。



バナー、リンクについて  ,   利用規約  ,   ヘルプ

Copyright (C) 1998-2007 WEST MiRa. All rights reserved.