:checkbox 返回值:Array<Element(s)>
概述
匹配所有复选框
示例
描述:
查找所有复选框
HTML 代码:
<form>
<input type="text" />
<input type="checkbox" />
<input type="radio" />
<input type="image" />
<input type="file" />
<input type="submit" />
<input type="reset" />
<input type="password" />
<input type="button" />
<select><option/></select>
...
:radio 返回值:Array<Element(s)>
概述
匹配所有单选按钮
示例
描述:
查找所有单选按钮
HTML 代码:
<form>
<input type="text" />
<input type="checkbox" />
<input type="radio" />
<input type="image" />
<input type="file" />
<input type="submit" />
<input type="reset" />
<input type="password" />
<input type="button" />
<select><option/></select>
...
:password 返回值:Array<Element(s)>
概述
匹配所有密码框
示例
描述:
查找所有密码框
HTML 代码:
<form>
<input type="text" />
<input type="checkbox" />
<input type="radio" />
<input type="image" />
<input type="file" />
<input type="submit" />
<input type="reset" />
<input type="password" />
<input type="button" />
<select><option/></select>
...
:text 返回值:Array<Element(s)>
概述
匹配所有的单行文本框
示例
描述:
查找所有文本框
HTML 代码:
<form>
<input type="text" />
<input type="checkbox" />
<input type="radio" />
<input type="image" />
<input type="file" />
<input type="submit" />
<input type="reset" />
<input type="password" />
<input type="button" />
<select><option/></select>...
:input 返回值:Array<Element(s)>
概述
匹配所有 input, textarea, select 和 button 元素
示例
描述:
查找所有的input元素
HTML 代码:
<form>
<input type="text" />
<input type="checkbox" />
<input type="radio" />
<input type="image" />
<input type="file" />
<input type="submit" />
<input type="reset" />
<input type="password" />
<input type="button" />
<select&...
第一步:先增加一个表单
<form id="myForm" action="comment.php" method="post">
Name: <input type="text" name="name" />
Comment: <textarea name="comment"></textarea>
<input type="submit" value="Submit Comment" />
</form>
第二步:jquery.js和form.js文件的包含
<head>
<script type="text/javascript" src="path/to/jquery.js"></script>
<script type="text/javascript" src="path/to/form.js"></script>
<scr...
前台文件:<script type="text/javascript" src="js/jquery.js" mce_src="js/jquery.js"></script> <input name="writer" id="writer" type="text" value="" /> <input name="pass" id="pass" type="password" value="" /> <input type="submit" name="button" id="button" value="提交" /> <!--这里不需要form,因为提交时call一个函数 <script type="text/javascript"> $(document).ready(function(){ //DOM的onload事件处理函数...
不像域级有效性检查(field-level validation),表单级有效性检查(form-level validation)将整个表单上的某组(或全部)值作为一个整体分析其一致性。表单级有效性检查一般发生在将一个已完成的HTML 表单提交给CGI 程序之前。我们这样做是为了确保用户在将数据发送至服务器之前,已经填写了所有的必填域。
验证整个表单其实相当简单。在我们的例子当中,我们已经去除了大部份会自动弹出即时警告信息的域级有效性检查。下面是一个例子:
function isANumber(number) {
answer = 1;
if (!parseFloat(number)) {
//the first digit wasn't numeric
answer = 0;
} else {
//the first digit was numeric, so check the res...
一旦你验证了用户已经输入有效的数据,那么就应该处理这些数据了。在JavaScript 中,处理表单数据相当容易。
我们将利用下面的函数来计算总认养额:
functioncalcTotal()
document.orderForm.totalPrice.value =
(document.orderForm.numberOrdered.value
* 15.99);
}
简单吧,不是吗?calcTotal() 函数简单地取出用户在numberOrdered域所提供的数字,然后将其乘以15.99。
计算出来的总额,接着会打印在“Total sponsorship fee”框中。
当然,这里是用来调用该函数的HTML:
Number of brains you'd like to sponsor
<INPUT TYPE="text" NAME="numberOrdered&q...
<input type=button value="Add" onclick='additem("tb")'><table id="tb" border="1"></table><script language="javascript">function additem(id){ var row,cell,str; row = eval("document.all["+'"'+id+'"'+"]").insertRow(); if(row != null ){ cell = row.insertCell(); str="<input type="+'"'+"file"+'"'+" name="+'"'+"addfile"+'"'+">项目<input type="+'"'+"text"+'"'+" name="+'"'+"v_item"+'"'+"><input type="+'"'+"button"+'"'+" value...
对于多数网页制作的朋友,实现在客户端保存在网页表单上的信息,比较多的是采用Cookie技术来实现,这些功能例如:下拉列表框选择的选项,文本框输入的数据等。事实上,我们可以利用微软DHTML默认行为中的userData行为来实现这个功能。 因为很多网友问到这样的问题,整理了一下,并提供了三个示例。下面将就该行为的使用做一个介绍: UserData 行为(userData Behavior): 1、说明: userData行为通过将数据写入一个UserData存储区(UserData store)来保存数据,userData可以将数据以XML格式保存在客户端计算机上,如果你用的是 Windows 2000 或者 Windows XP,是保存在C:Documents and SettingsLimingUserData文...
1 javascript ,设置一个变量,只允许提交一次。
<script language="javascript">
var checkSubmitFlg = false;
function checkSubmit() {
if (checkSubmitFlg == true) {
return false;
}
checkSubmitFlg = true;
return true;
}
document.ondblclick = function docondblclick() {
window.event.returnValue ...
近日看到关于验证码的讨论颇多,发旧文一篇。颇认为本文作者对图灵测试的描述浅显易懂。并且Text_CAPTCHA确实能省不少事~~推荐使用~~ http://mikespook.cnblogs.com/archive/2005/03/02/111758.html ------------------------------ 使用 PEAR的Text_CAPTCHA保护Web表单 作者 Marcus Whitney 翻译 mikespook 来源 http://phpsec.org 当你在网络上有公开的表单的时候,你总是需要去提防那些使用你的程序来满足自己的意图的那些人。在论坛、开放图书馆、留言簿和BLOG上被自动提交机(原文是“robots”)找到并提...
如果您曾经遇到过在运行时修改所有控件的工作,您一定能体会到逐个修改控件是一件多么烦琐的事情了。实际上,在VB.NET中有一种简单的方法可以实现这一功能。控件选择表单包含了一系列控件,您可以对这些控件进行循环选择,从而在运行时改变您需要的控件属性。例如,在表单上添加两个文本框,然后添加以下的代码:Private Sub SetControls()Dim cControl As ControlFor Each cControl InMe.ControlsIf (TypeOf cControl Is TextBox) ThencControl.Text = "abc"End IfNext cControlEnd Sub在这个例子中,我将变量cControl定义为控件对象,然后创建了一个FOR循环来检查表单上所有的控件,如果该控...
在struts中,我们都知道他拥有自己的标记,如下: <html:form action="coreyForm"> <html:text property="name" /> <html:password property="pwd" /> <html:submit value="submit" /> </html:form> 最后,他们会生成如下html标签: <form action="./coreyForm.do"> <input type="text" name="name" /> <input type="password" name="pwd" /> <input type="submit" value="submit" /> </form> 有的时候,我们会选择不采用struts的html便签等等,其实这样的话,不...
前实现AJAX使用Javascript脚本一个一个敲出来的,很繁琐。学习Jquery之后就感觉实现AJAX并不是那么的困难了,当然除了Jquery框架外还有其它的优秀框架这里我就着重说下比较流行的Jquery。Jquery AJAX提交表单有两种方式,一是url参数提交数据,二是form提交(和平常一样在后台可以获取到Form表单的值)。在所要提交的表单中,如果元素很多的话建议用第二种方式进行提交,当然你要是想练练“打字水平”的话用第一种方式提交也未尝不可,相信开发者都不想费白劲吧!废话不多说了贴实例。 首先要下载Jquery、Jquery.form这两个插件以下是代码:【复制】 <script type ="text/javascript" src ="../...