`
tsailer
  • 浏览: 53074 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类

deal with a great quantity domelements add event wait for update

    博客分类:
  • JS
阅读更多
<!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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="generator" content="editplus" />
  <meta name="author" content="" />
  <meta name="keywords" content="" />
  <meta name="description" content="" />
 </head>

 <body>

 </body>
 <script language="JavaScript" type="text/javascript">
 <!--
var ul_val = document.createElement("ul");
for (var i = 0; i < 1000; i++) {
    var li_val = document.createElement("li");
    li_val.innerHTML = (i + 1);
    ul_val.appendChild(li_val);
}
document.body.appendChild(ul_val);
function getEventTarget(e) {
    e = e || window.event;
    return e.target || e.srcElement;
}
function editCell(e) {
    var target = getEventTarget(e);
	//其中target即是添加事件的dom元素
    /*if (target.tagName.toLowerCase() === ‘td’) {
        // DO SOMETHING WITH THE CELL  
    }*/
	alert(target.innerHTML);
}
//function AttachEvent(target, eventName, handler, argsObject) {
function AttachEvent(target, eventName, handler) {
    var eventHandler = handler;
    /*if (argsObject) {
        eventHander = function(e) {
            handler.call(argsObject, e);
        }
    }*/
	//以上注释的代码不知道做什么
    if (window.attachEvent){ //IE  
		target.attachEvent("on" + eventName, handler);
    }else{ //FF  
	    target.addEventListener(eventName, handler, false);
	}
}
//AttachEvent(ul_val, "click", editCell, obj);
AttachEvent(ul_val, "click", editCell);
 //-->
 </script>
</html>
分享到:
评论

相关推荐

    Beginning JavaScript with DOM Scripting and Ajax: Second Editon

    Beginning JavaScript with DOM Scripting and Ajax is an essential resource for modern JavaScript programming. This completely updated second edition covers everything you need to know to get up-to-...

    Beginning JavaScript with DOM Scripting and Ajax (pdf + ePub)

    Beginning JavaScript with DOM Scripting and Ajax is for the person who has a good grasp of HTML and CSS but wants to add JavaScript to their skillset. If you want to learn some basic programming ...

    HDR Deghosting: How to deal with Saturation

    HDR(高动态范围)摄影是一种技术,用于在一张图像中捕捉和再现场景的宽广亮度范围,这在现实生活中很常见,但传统相机往往难以捕捉。然而,HDR图像处理过程中可能会遇到一个问题,即“鬼影”现象。...

    af-phy-0039.000.pdf.zip_Deal With It_sonet

    The Level 1 Specification was designed to deal with the following PHY layer interfaces : 1. 2. 3. 4. 5. 155.52 Mbps (SONET/OC-3c) 155.52 Mbps (8B/10B block coded) 100 Mbps (4B/5B TAXI) 44.1236 Mbps ...

    高中英语 知识点大全41 deal with do with的区别

    【deal with / do with 的区别】 在高中英语学习中,理解和掌握 deal with 和 do with 这两个短语的用法是非常关键的。首先,两者都用于表示“处理”或“对付”的意思,但在搭配和使用上有明显的差异。 1) deal ...

    sctp.rar_Deal With It

    This driver doesn t deal with the exact protocol used during the session. It is intended to be as simple as something like.

    Building a Quadcopter with Arduino

    Enlighten your understanding about the flight by performing step-by-step pre-flight adjustments and acquiring the instructions for a safe flight Get the best tips to deal with performance issues ...

    Automating with Node.js

    If your job is loaded with manual work, then why not write scripts that can deal with it for you? With this book, you will learn how to deal with many tasks such as zipping files, emailing colleagues...

    Foundations for Analytics with Python O-Reilly-2016-Clinton W. Brownley

    Foundations for Analytics with Python by Clinton W. Brownley Copyright © 2016 Clinton Brownley. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 ...

    Computational methods for fluiddynamics

    The book also contains a great deal of practical advice for code developers and users; it is designed to be equally useful to beginners and experts.The issues of numerical accuracy, estimation and ...

    Foundations.for.Analytics.with.Python.1491922532.epub

    Many of Excel's 750 million users would like to do more with their data, such as repeating similar analyses over hundreds of files or combining the data in many files for analysis at one time....

    Bayes' Theorem Examples: A Visual Introduction For Beginners

    At its core, Bayes' Theorem is a simple probability and statistics formula that has revolutionized how we understand and deal with uncertainty. If life is seen as black and white, Bayes' Theorem helps...

    Kernels for Vector-Valued Functions A Review

    there has been an increasing interest in methods that deal with multiple outputs, motivated partly by frameworks like multitask learning. In this paper, we review different methods to design or learn ...

    考研英语常用短语打印版.doc

    21. a good/great deal of: 修饰不可数名词,表示"大量",如 "She has a great deal of experience in teaching." 22. a good/great many: 修饰可数名词复数,表示"大量",如 "There are a great many students ...

    摸底考试作文垃圾处理how to deal with garbagePPT课件.pptx

    "摸底考试作文垃圾处理how to deal with garbage"这一主题旨在引导学生深入理解这个问题,并探讨有效的解决策略。在撰写关于这一主题的文章时,我们需要遵循一些关键原则,避免解题大忌,如混淆文体、无草稿以及死板...

    快思聪编程之deal_for_windows

    安装simpl_windows_2.08.41前需称安装simpl_plus_cross_compiler和crestron_database,最后安装vt_pro-e 工具

    Large Scale Machine Learning with Python

    But finding algorithms and designing and building platforms that deal with large sets of data is a growing need. Data scientists have to manage and maintain increasingly complex data projects, and ...

Global site tag (gtag.js) - Google Analytics