关于vbscript,判断用户文本框输入是否正确?
我做了一个用户注册表单界面怎样在密码框输入完毕时判断密码是否大于6位数并在密码框旁输出“密码输入不正确!”(这是关键,不是msgbox,是在一旁输出)先谢过……...
我做了一个用户注册表单界面
怎样在密码框输入完毕时
判断密码是否大于6位数
并在密码框旁输出“密码输入不正确!”(这是关键,不是msgbox,是在一旁输出)
先谢过…… 展开
怎样在密码框输入完毕时
判断密码是否大于6位数
并在密码框旁输出“密码输入不正确!”(这是关键,不是msgbox,是在一旁输出)
先谢过…… 展开
展开全部
test.html 代码如下
<link href="SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<script src="SpryValidationTextField.js" type="text/javascript"></script>
<style type="text/css">
.tablecell input{
width:150px;
}
.tablecell{
width:33%;
float:left;
height:60px;
}
td{
vertical-align:top;
padding:2px;
}
#min_max_char.textfieldRequiredState .textfieldRequiredMsg,
#min_max_char.textfieldMaxCharsState .textfieldMaxCharsMsg ,
#min_max_char.textfieldMinCharsState .textfieldMinCharsMsg{
display:inline;
color:#0033CC;
border:1px blue solid;
}
</style>
<form id="form4" name="form4" method="get" action="TextfieldValidationSample.html">
<table>
<tr id="password">
<td>输入密码:</td>
<td>
<input name="text11" type="password" id="text11" />
<span class="textfieldRequiredMsg">必须输入密码</span>
<span class="textfieldMinCharsMsg">密码最少需要6位</span>
<span class="textfieldMaxCharsMsg">密码不能超过16位</span>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="submit4" id="submit4" value="提交" />
<input name="Reset" type="reset" value="重置" />
</td>
</tr>
</table>
</form>
<script type="text/javascript">
<!--
var password = new Spry.Widget.ValidationTextField("password", "none", {minChars:6, maxChars:16, validateOn:["blur"]});
//-->
</script>
SpryValidationTextField.css 文件
@charset "UTF-8";
/* SpryFormValidation.css - version 0.4 - Spry Pre-Release 1.5 */
/* Copyright (c) 2006. Adobe Systems Incorporated. All rights reserved. */
/* These are the classes applied on the error messages
* which prevent them from being displayed by default.
*/
.textfieldRequiredMsg,
.textfieldInvalidFormatMsg,
.textfieldMinValueMsg,
.textfieldMaxValueMsg,
.textfieldMinCharsMsg,
.textfieldMaxCharsMsg,
.textfieldValidMsg {
display: none;
}
/* These selectors change the way messages look when the widget is in one of the error states.
* These classes set a default red border and color for the error text.
* The state class (e.g. .textfieldRequiredState) is applied on the top-level container for the widget,
* and this way only the specific error message can be shown by setting the display property to "inline".
*/
.textfieldRequiredState .textfieldRequiredMsg,
.textfieldInvalidFormatState .textfieldInvalidFormatMsg,
.textfieldMinValueState .textfieldMinValueMsg,
.textfieldMaxValueState .textfieldMaxValueMsg,
.textfieldMinCharsState .textfieldMinCharsMsg,
.textfieldMaxCharsState .textfieldMaxCharsMsg
{
display: inline;
color: #CC3333;
border: 1px solid #CC3333;
}
/* The next three group selectors control the way the core element (INPUT) looks like when the widget is in one of the states: * focus, required / invalid / minValue / maxValue / minChars / maxChars , valid
* There are two selectors for each state, to cover the two main usecases for the widget:
* - the widget id is placed on the top level container for the INPUT
* - the widget id is placed on the INPUT element itself (there are no error messages)
*/
/* When the widget is in the valid state the INPUT has a green background applied on it. */
.textfieldValidState input, input.textfieldValidState {
background-color: #B8F5B1;
}
/* When the widget is in an invalid state the INPUT has a red background applied on it. */
input.textfieldRequiredState, .textfieldRequiredState input,
input.textfieldInvalidFormatState, .textfieldInvalidFormatState input,
input.textfieldMinValueState, .textfieldMinValueState input,
input.textfieldMaxValueState, .textfieldMaxValueState input,
input.textfieldMinCharsState, .textfieldMinCharsState input,
input.textfieldMaxCharsState, .textfieldMaxCharsState input {
background-color: #FF9F9F;
}
/* When the widget has received focus, the INPUT has a yellow background applied on it. */
.textfieldFocusState input, input.textfieldFocusState {
background-color: #FFFFCC;
}
/* This class applies only for a short period of time and changes the way the text in the textbox looks like.
* It applies only when the widget has character masking enabled and the user tries to type in an invalid character.
*/
.textfieldFlashText input, input.textfieldFlashText {
color: red !important;
}
/* When the widget has the hint message on, the hint text can be styled differently than the user typed text. */
.textfieldHintState input, input.textfieldHintState {
/*color: red !important;*/
}
SpryValidationTextField.js 文件地址在下面
『Spry validation表单.files/SpryValidationTextField.js』括号中是下载地址
<link href="SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<script src="SpryValidationTextField.js" type="text/javascript"></script>
<style type="text/css">
.tablecell input{
width:150px;
}
.tablecell{
width:33%;
float:left;
height:60px;
}
td{
vertical-align:top;
padding:2px;
}
#min_max_char.textfieldRequiredState .textfieldRequiredMsg,
#min_max_char.textfieldMaxCharsState .textfieldMaxCharsMsg ,
#min_max_char.textfieldMinCharsState .textfieldMinCharsMsg{
display:inline;
color:#0033CC;
border:1px blue solid;
}
</style>
<form id="form4" name="form4" method="get" action="TextfieldValidationSample.html">
<table>
<tr id="password">
<td>输入密码:</td>
<td>
<input name="text11" type="password" id="text11" />
<span class="textfieldRequiredMsg">必须输入密码</span>
<span class="textfieldMinCharsMsg">密码最少需要6位</span>
<span class="textfieldMaxCharsMsg">密码不能超过16位</span>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="submit4" id="submit4" value="提交" />
<input name="Reset" type="reset" value="重置" />
</td>
</tr>
</table>
</form>
<script type="text/javascript">
<!--
var password = new Spry.Widget.ValidationTextField("password", "none", {minChars:6, maxChars:16, validateOn:["blur"]});
//-->
</script>
SpryValidationTextField.css 文件
@charset "UTF-8";
/* SpryFormValidation.css - version 0.4 - Spry Pre-Release 1.5 */
/* Copyright (c) 2006. Adobe Systems Incorporated. All rights reserved. */
/* These are the classes applied on the error messages
* which prevent them from being displayed by default.
*/
.textfieldRequiredMsg,
.textfieldInvalidFormatMsg,
.textfieldMinValueMsg,
.textfieldMaxValueMsg,
.textfieldMinCharsMsg,
.textfieldMaxCharsMsg,
.textfieldValidMsg {
display: none;
}
/* These selectors change the way messages look when the widget is in one of the error states.
* These classes set a default red border and color for the error text.
* The state class (e.g. .textfieldRequiredState) is applied on the top-level container for the widget,
* and this way only the specific error message can be shown by setting the display property to "inline".
*/
.textfieldRequiredState .textfieldRequiredMsg,
.textfieldInvalidFormatState .textfieldInvalidFormatMsg,
.textfieldMinValueState .textfieldMinValueMsg,
.textfieldMaxValueState .textfieldMaxValueMsg,
.textfieldMinCharsState .textfieldMinCharsMsg,
.textfieldMaxCharsState .textfieldMaxCharsMsg
{
display: inline;
color: #CC3333;
border: 1px solid #CC3333;
}
/* The next three group selectors control the way the core element (INPUT) looks like when the widget is in one of the states: * focus, required / invalid / minValue / maxValue / minChars / maxChars , valid
* There are two selectors for each state, to cover the two main usecases for the widget:
* - the widget id is placed on the top level container for the INPUT
* - the widget id is placed on the INPUT element itself (there are no error messages)
*/
/* When the widget is in the valid state the INPUT has a green background applied on it. */
.textfieldValidState input, input.textfieldValidState {
background-color: #B8F5B1;
}
/* When the widget is in an invalid state the INPUT has a red background applied on it. */
input.textfieldRequiredState, .textfieldRequiredState input,
input.textfieldInvalidFormatState, .textfieldInvalidFormatState input,
input.textfieldMinValueState, .textfieldMinValueState input,
input.textfieldMaxValueState, .textfieldMaxValueState input,
input.textfieldMinCharsState, .textfieldMinCharsState input,
input.textfieldMaxCharsState, .textfieldMaxCharsState input {
background-color: #FF9F9F;
}
/* When the widget has received focus, the INPUT has a yellow background applied on it. */
.textfieldFocusState input, input.textfieldFocusState {
background-color: #FFFFCC;
}
/* This class applies only for a short period of time and changes the way the text in the textbox looks like.
* It applies only when the widget has character masking enabled and the user tries to type in an invalid character.
*/
.textfieldFlashText input, input.textfieldFlashText {
color: red !important;
}
/* When the widget has the hint message on, the hint text can be styled differently than the user typed text. */
.textfieldHintState input, input.textfieldHintState {
/*color: red !important;*/
}
SpryValidationTextField.js 文件地址在下面
『Spry validation表单.files/SpryValidationTextField.js』括号中是下载地址
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-10-17
展开全部
用document.Write即可。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询