JS判断表单内容是否更改过
1,根据具体标签判断
function JudgesubmitForm() {
var judjeWs = false;
var judjeAt = false;
var judjeWd = false;
var ws = document.getElementById('WorkOrderStatusList');//下拉框
var wsold = ws.options[ws.selectedIndex].value;
var At = document.getElementById('AlarmHandleTypeList');//下拉框
var Atold = At.options[At.selectedIndex].value;
var wd = document.getElementById('OrderHandle');//输入框
//At.options[At.selectedIndex].defaultSelectedif (wsold!="")
{
console.log("修改WS");
judjeWs = true;
}
if (Atold != "") {
console.log("修改AT");
judjeAt = true;
}
if (wd.value != wd.defaultValue)
{
console.log("修改Wd");
judjeWd = true;
}
if (judjeWs == true||judjeAt == true||judjeWd == true)
{
return true;
}
else
{
return false;
}
}
2遍历所有的form标签
function JudgesubmitForm() {
var form = document.getElementById('ImgForm');
for (var i = 0; i < form.length; i++) {
var element = form.elements[i];
var type = element.type;
if (type == "checkbox" || type == "radio") {
if (element.checked == element.defaultChecked) {
console.log("没有选择单选或多选框");
}
}
if (type == "hidden" || type == "password" || type == "text" || type == "textarea") {
if (element.value == element.defaultValue) {
console.log("没有进行文本输入");
}
}
if (type == "select-one" || type == "select-multiple") {
for (var j = 0; j < element.options.length; j++) {
if (element.options[j].selected == element.options[j].defaultSelected) {
console.log("没有选择下拉框");
}
}
}
if (type == "file") {
if (element.value.length == 0) {
Filechange = false;
console.log("没选择图片");
}
}
}
JS判断表单内容是否更改过的更多相关文章
- js 判断表单是否为空和是否是有效数字
判断是否为空和是否是有效数字 <s:form name='form' onsubmit="return myCheck()" method="post" ...
- jQuery:提交表单前判断表单是否被修改过
表单加载完成后执行 : //表单中包含input(text,checkbox,hidden),select,radio, $("#editWithdrawAutoApprovedConf ...
- jquery判断表单内容是否为空
//判断表单数据是否为空 var t = $('form').serializeArray(); $.each(t,function(i,item){ if(item['value'] == '') ...
- Unieap3.5-前台js判断表单必录
//用户信息字段检查 var custFrm=unieap.byId('custFrm'); var isValid=custFrm.validate(true); if(!isValid){ ret ...
- jquery.form.js 让表单提交更优雅
jquery.form.js 让表单提交更优雅.可以页面不刷新提交表单,比jQuery的ajax提交要功能强大. 1.引入 <script src="/src/jquery-1.9.1 ...
- js控制select选中显示不同表单内容
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- js实现表单验证 常用JS表单验证
CSS代码 @charset "gb2312"; /* CSS Document */ body,dl,dt,dd,div,form {padding:;margin:;} #he ...
- 分页功能实现之通过ajax实现表单内容刷新
拿代码来说话 我们的需求就是点击翻页功能,实现表格内容局部刷新且能够翻到对应的页面上,不明白? 那么就看看下面的图,需要达到的效果如下所示: 现在要实现的功能就是把红线框起来的表单内容 在点击翻页的时 ...
- c#程序为PDF文件填写表单内容
众所周知,PDF文件一般情况下是无法修改的,如果你有一张现成的PDF表格,这时想通过编程实现从数据库或者动态生成内容去填写这张表格,就会有些问题了,首先我们要解决以下2个重要的问题: 1.如何将内容写 ...
随机推荐
- Eclipse 常用快捷键 (动画讲解)(转载)
http://www.cnblogs.com/TankXiao/p/4018219.html#fix 很详细呀/
- locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory
安装好CentOS后,第一次进入系统使用locate命令,结果出现:locate: can not stat () `/var/lib/mlocate/mlocate.db': No such fil ...
- FtpClient的使用
摘自:http://hi.baidu.com/yuanhotel/item/000b6334894d11f42784f4da Java的ftp操作 package com.why.ftp; impor ...
- [原创] Assistant editor 取消拖拽 binding 的 UI 元素
1. press up-right button "show the utilities" 2. press "show the Connections inspecto ...
- SqlHelper 简单版
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.D ...
- C# Cache何时使用及使用方法
Cache 即高速缓存.那么cache是怎么样提高系统性能与运行速度呢?是不是在任何情况下用cache都能提高性能?是不是cache用的越多就越好呢?我在近 期开发的项目中有所体会,写下来当作总结也希 ...
- 关于json对象的遍历
json格式的数据越来越多的在web开发中起到重要作用.下面介绍对于json对象和数组经常用到解析方法. var obj ={”name”:”冯娟”,”password”:”123456″,”depa ...
- Python成长之路_装饰器
一.初入装饰器 1.首先呢我们有这么一段代码,这段代码假设是N个业务部门的函数 def f1(aaa): print('我是F1业务') if aaa == 'f1': return 'ok' def ...
- HDU 2553 N皇后问题(dfs)
N皇后问题 Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Description 在 ...
- 使用事件CreateEvent注意事项
HANDLECreateEvent( LPSECURITY_ATTRIBUTESlpEventAttributes,// 安全属性 BOOLbManualReset,// 复位方式 BOOLbInit ...