- 浏览: 53049 次
- 性别:
- 来自: 深圳
<!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> new document </title> <meta name="generator" content="editplus" /> <meta name="author" content="" /> <meta name="keywords" content="" /> <meta name="description" content="" /> <style type="text/css"> <!-- div{width:100px;height:100px;_padding-left:26px;} #id_click{border:1px solid #FddD33;float:left;} .sss{border:1px solid #F0dD33;float:left;} .exceptme{border:1px solid #00dD33;float:left;} .includeme{border:1px solid #Fd0033;float:left;} --> </style> </head> <body> <div id="id_click"></div> <div id="sss" class="sss"></div> <div id="exceptme" class="exceptme"></div> <div id="includeme" class="includeme"></div> </body> <script src="http://www.pingan.com/app_js/jquery-1.3.2.js" type="text/javascript"></script> <script language="JavaScript" type="text/javascript"> <!-- function domEvent(){} domEvent.prototype = { objtoarr:function (obj){ var arr = [],m=0; if(obj.length>1){ while(m<obj.length){ arr[m] = obj[m]; m++; } }else{ arr[0]=obj } return arr; } ,dom_exceptjs:function (){ var obj_dom = document.getElementsByTagName("body").item(0).children; var obj_script = document.getElementsByTagName("script"); var m=0, n=0, arr_dom=[], arr_script=[]; arr_dom = this.objtoarr(obj_dom); arr_script = this.objtoarr(obj_script); for(var i=0; i<arr_dom.length;i++){ for(var j=0;j<arr_script.length;j++){ if(arr_dom[i]==arr_script[j]){ arr_dom.splice(i,1); } } } return arr_dom; } ,removeunusedom:function (total, goal){ for(var i=0;i<total.length;i++){ if(total[i]==goal){ total.splice(i,1); return total; } } return false; } ,addEvent:function (dom,type,func){ if(document.attachEvent){ dom.attachEvent("on"+type,func);//ie } if(document.addEventListener){ dom.addEventListener(type,func,true);//mozillar } } ,removeEvent:function (dom,type,func){ if(document.attachEvent){ dom.detachEvent("on"+type,func); } if(document.addEventListener){ dom.removeEventListener(type,func,true); } } } var actdemo = new domEvent(); (function(){ var toa_AddEvent = actdemo.removeunusedom(actdemo.objtoarr(document.getElementsByTagName("div")),document.getElementById("exceptme")); for(var i=0;i<toa_AddEvent.length;i++){ //alert("00"); /*actdemo.addEvent(toa_AddEvent[i],"click",function(){ //var dom = toa_AddEvent[i]; alert(this.getAttribute("id")); })*/ actdemo.addEvent(toa_AddEvent[i],"click",function(e){ var target = e.srcElement || e.target; alert(target.getAttribute("id")); }) } })() //--> </script> </html>
发表评论
-
JS的replace方法
2011-08-05 10:34 1201from http://www.cnblogs.com/mxw ... -
要写出在各大主流浏览器上都兼容的JS代码,就要关注他们的区别,下是IE和FF综合考虑的通用DOM!
2011-08-04 14:36 921来源于 http://hi.baidu.com/g ... -
<input type="text" id="start" />输入true取布尔true
2011-07-28 14:22 880"true" and true is di ... -
Js获取当前日期时间+日期验证+判断闰年+日期的天数差+日期格式化+JS判断某年某月有多少天
2011-07-27 17:47 4813字符串转日期型+Js当前日期时间+日期验证+判断闰年+日期的天 ... -
高效http页面优化法则一【JS对DOM的操作】
2011-07-08 10:58 1033很多人都认为JS的效率 ... -
form page jump
2011-07-07 10:49 853页面跳转 <input type="hidd ... -
jquery widget sample
2011-07-06 08:39 3446<!DOCTYPE html PUBLIC &quo ... -
jquery apply wait for update
2011-07-05 10:36 1658<!DOCTYPE html PUBLIC &quo ... -
deal with a great quantity domelements add event wait for update
2011-06-29 14:34 1159<!DOCTYPE html PUBLIC " ... -
JS中的attachEvent、addEventListener如何传递参数
2011-06-29 14:02 6268<!DOCTYPE html PUBLIC " ... -
window.onload 和 $(document).ready 区别 待续......
2011-06-27 09:50 2750jquery 学习之一(js中window ... -
js operate frame
2011-06-14 14:04 1193我的页面框架如下 <frameset rows=&quo ... -
js中frame的调用
2011-06-14 12:27 1043js中frame的调用 关键词 ... -
js 事件冒泡 和其它问题
2011-06-10 09:25 820js事件冒泡 <html> <head> ... -
js inner iframe get dom of parent
2011-06-02 15:00 732parent.$("#id");//jqu ... -
ajax
2011-05-27 14:18 645<!DOCTYPE html PUBLIC " ... -
count down 倒计时
2011-05-13 12:42 575<!DOCTYPE html PUBLIC " ... -
js IE与FireFox的兼容性问题 事件
2011-05-13 09:16 1029# window.event * IE:有windo ... -
deal with href remove the same element
2011-05-11 09:38 800var url="http://zhidao.bai ... -
document.form.item 问题集合的(0)和[0]取法
2011-05-09 15:10 1951<!DOCTYPE html PUBLIC " ...
相关推荐
These eight minibooks get you started, explain standards, and help you connect all the dots to create sites with pizzazz. This handy, one–stop guide catches you up on XHTML basics and CSS ...
In just one hour a day, you’ll learn the skills you need to design, create, and maintain a professional-looking website. No previous experience required. By following each short, one-hour lesson in ...
- FIX: After deleting the selected points in the TFlexPanel.DeleteSelectedPoints the all figures with one point also deleted. - FIX: When the curve contain more then one figure and they were all ...
- **The jQuery Wrapper:** When you use JQuery to select or create elements, you receive a wrapper object that contains all the matched DOM elements. This wrapper provides a consistent interface for ...
dom4j常用方法 i.SAXReader sr = new SAXReader(); 生成解析器对象 ii.解析器对象.read(file对象); 解析文件生成Document对象 iii.文档对象.getRootElement() 获取跟元素节点 iv.元素节点.elements() 获取到指定...
This completely updated second edition covers everything you need to know to get up-to-speed with JavaScript development and add dynamic enhancements to web pages, right from the basics. As well as ...
Concepts are presented in a "to-the-point" style to cater to the busy individual. With this book, you can learn HTML and CSS in just one day and start coding immediately. How is this book different.....
All In 1 Sprite Shader is an all in one solution to add cool popular sprite and UI effects to your project in the easiest and fastest way possible. It includes 40+ combinable effects. The ...
How to access and update part of the page using code. How to use JavaScript to communicate with the server and retrieve data. How to use JavaScript to for form validation and user feedback. How to use...
✨All In 1 Sprite Shader✨ is an all in one solution to add cool popular sprite and UI combinable effects to your project in the easiest and fastest way possible.
rootElement.addElement("child").addText("Hello, DOM4J!"); ``` 这段代码首先创建了一个`DocumentFactory`实例,然后通过它创建了一个新的XML文档,并添加了一个根元素`root`,在根元素下又添加了一个子元素`child...
Download the 2013 v1 update to access the new TileControl to achieve a Windows 8 look and feel in your desktop apps as well as feature enhancements for Reports, Editor, and Scheduler. See the what's ...
Download the 2013 v1 update to access the new TileControl to achieve a Windows 8 look and feel in your desktop apps as well as feature enhancements for Reports, Editor, and Scheduler. See the what's ...
Download the 2013 v1 update to access the new TileControl to achieve a Windows 8 look and feel in your desktop apps as well as feature enhancements for Reports, Editor, and Scheduler. See the what's ...
This directive has only one attribute named as file, which is used to include a file in the jsp page at the translation time. <jsp:include page = " ">:- This is known as the include standard action....
The book explains how jQuery facilitates this separation by enabling the use of event delegation and by making it easy to add behavior to elements without hard-coding JavaScript directly into the ...
If you want to call any function when any page flipped add it to the OnFlip Event List. If you want to resize the area that the user can drag the page from it, open the Book node in inspector ...
(b) the name of the table, the names of the table's attributes, the data types of the table's attributes, the formats of the table's attributes, and the maximum number of rows that the table can have...