/*说明:解决IE6下下拉框Bug赋值问题 */ $.SelectVal=function (sel, val) { if ($.browser.msie && $.browser.version == "6.0") { setTimeout(function () { sel.val(val); }, 1); } else { sel.val(val); } } /*说明:验证表单元素值是否发生改变 */ $.isFormChanged = function (el, filter) { filter = filter ||function (el) {return false;}; var els = el.elements, l = els.length, i = 0, j = 0, el, opts; for (; i < l; ++i, j = 0) { el = els[i]; switch (el.type) { case "text": case "hidden": case "password": case "textarea": if (filter(el)) break; if (el.defaultValue != el.value) return true; break; case "radio": case "checkbox": if (filter(el)) break; if (el.defaultChecked != el.checked) return true; break; case "select-one": j = 1; case "select-multiple": if (filter(el)) break; opts = el.options; for (; j < opts.length; ++j) { if (opts[j].defaultSelected != opts[j].selected) return true; } break; } } return false; };
![](https://img2024.cnblogs.com/blog/35695/202408/35695-20240826070647288-243310440.jpg)