兼容IE & Firefox 的脚本改本属性值的检测方法 [ 不支持Chrome ]
来源:互联网 发布:贤者之爱结局知乎 编辑:程序博客网 时间:2024/05/16 19:39
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head> <title></title></head><body> <input id="chkTest" type="checkbox" checked="checked"/> <input type="button" value="更改" onclick="ChangeCHK()" /> <script type="text/javascript"> var chkTest = document.getElementById("chkTest"); if (chkTest.watch) { chkTest.watch("checked", function (id, oldval, newval) { alert(newval); return newval; }); } else { chkTest.onpropertychange = function () { alert(this.checked); } } </script> <script type="text/javascript"> function ChangeCHK() { var check = chkTest.checked; chkTest.checked = check == true ? false : true; } </script></body></html>
————————————————————————————————————————————————————————————
下面的代码支持所有的浏览器, 可惜效率不高。
————————————————————————————————————————————————————————————
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><script> var insObj = new Array(); var timer = null; function $(id) { return document.getElementById(id) }; function changeInspector(id) { insObj[id] = "" + $(id).value; timer = setInterval("inspector('" + id + "')", 100); } function inspector(sid) { if ($(sid).value != insObj[sid]) { alert("property changed"); insObj[sid] = $(sid).value; } } function doinspector() { changeInspector("mm"); changeInspector("mm2"); }</script></head><body onload="doinspector()"><input type="text" id="mm" value=""></input><input type="text" id="mm2" value=""></input><input type="button" onclick="document.getElementById('mm').value='aa'" value="改变值"></input>在doinspector 函数里 添加 就可以了changeInspector(对象的ID); //例如 changeInspector("mm");</body></html>
- 兼容IE & Firefox 的脚本改本属性值的检测方法 [ 不支持Chrome ]
- firefox兼容ie的dom方法脚本
- 兼容ie,firefox,chrome的跨域加载js脚本
- 兼容IE-FireFox-Chrome的背景音乐播放
- 兼容IE-FireFox-Chrome的背景音乐播放
- javascript firefox兼容ie的dom方法脚本
- iframe框架取值兼容ie/firefox/chrome的写法
- ie不支持trim的属性兼容解决方案
- js脚本:ie和firefox的兼容
- 兼容IE/Firefox/Opera/Safari的检测页面装载完毕的脚本Ext.onReady的实现
- 兼容IE/Firefox/Opera/Safari的检测页面装载完毕的脚本Ext.onReady的实现
- margin在IE、Firefox、Chrome、Safari下兼容的超级方法!
- input file本地图片预览的方法(兼容IE、Chrome和Firefox)
- 兼容FireFox/IE的insertAdjacentHTML方法【Ext2】
- 兼容FireFox/IE的insertAdjacentHTML方法
- 兼容firefox、chrome、ie的wmp网页播放器代码
- 兼容IE,FireFox,Chrome主流的文字阴影功能。
- 兼容IE、FireFox、Chrome等浏览器的xml处理函数
- 特征方程
- .Net Remoting(远程方法回调)
- Android平台的音乐资源管理与播放
- VC调试DLL方法
- 根据日志文件将数据库还原至指定的时间点
- 兼容IE & Firefox 的脚本改本属性值的检测方法 [ 不支持Chrome ]
- Android2.2下camera应用程序支持GPS信息写入jpeg文件
- 无线路由器不能产生信号
- 无向网最小生成树 prim算法 和 kruskal算法
- Windows错误:堆被损坏
- mysql注入问题
- Asp.net MVC 中Controller返回值类型ActionResult
- DFS 深度优先搜索
- quartus虚拟按键生成