好吧,所以我构建了一个自定义注册页面,当然还有涉及到javascript输入验证。maxlength对某些元素不起作用
在验证中,我使用maxlength
属性来验证输入的长度 - 这是一种双重安全性,但它很容易获得元素的属性,我认为“为什么不呢?”。
但是,我发现在我的某些表单输入元素上属性为undefined
,并在其他表单上正确定义。
我一直在看几天的HTML,我不明白为什么它没有在一些元素上定义,但对大多数作品。
我已经构建了一个工作和非工作元素都存在的页面,虽然它不是它应该如何放在一起。
Here is a link到那,下面是一个非工作形式的例子。我希望你们中的一些人能看到它有什么问题!
代码:
<div id="9irBGsdLR">
<form method="POST" class="form" name="frontContent" id="forntContent" style="margin-bottom:15px;">
<div id="9button" style="float:right;">
<img onclick="deleteElement('9', '9irBGsdLR', this, 'actions/delete.php')" alt="delete" style="border:0px;float:right;cursor:pointer;" src="./validationNotWorking_files/close_32.png">
</div>
<input type="text" name="id" style="display:none;" value="9">
<label class="inputlabel softInputlabel" style="width:20%;">Headline: </label>
<input maxlenght="50" type="text" name="title" id="title" class="inputfield" contenttype="text" value="Praesent rhoncus faucibus elementum">
<label class="inputlabel softInputlabel" style="width:20%;">Succession: </label>
<input maxlenght="4" type="text" name="succession" id="title" class="inputfield" contenttype="numerical" value="50">
<label class="inputlabel softInputlabel" style="width:20%;">Content: </label>
<textarea class="formField" style="width:75%;height:300px;" name="content"></textarea>
</form>
<hr>
</div>
maxlenght = “50”? – 2013-04-09 12:19:15