整数のみ受け付けるようにする

書式

feObj = new Spry.Widget.ValidationTextField(elementID, "integer")

feObj : エレメントオブジェクト
elementID : エレメントID

説明

整数のみ受け付けるようにするにはSpry.Widget.ValidationTextField()の二番目のパラメータにintegerを指定します。

サンプルコード [実行]

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Sample</title>
<link rel="stylesheet" href="css/SpryValidationTextField.css" type="text/css" media="all">
<script src="js/SpryValidationTextField.js" type="text/javascript"></script>
<script type="text/javascript"><!--
window.onload = function() {
new Spry.Widget.ValidationTextField("checkText1", "integer", {validateOn:["change"]});
}
// --></script>
</head>
<body>
<h1>Adobe Spry : 入力チェック サンプル</h1>
<p>整数が入力されていればOK。チェックは入力時に行われます。
<form action="send.html">
<span id="checkText1">
<input type="text" name="text1" id="text1">
<span class="textfieldRequiredMsg">何か数値を入れてください</span>
<span class="textfieldInvalidFormatMsg">整数以外は受け付けません</span>
</span>
<input type="submit" value="送信">
</form>
</body>
</html>