<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title> <script> /*
alert(this); window fn1(this);
function fn1(obj){
obj => window
} oDiv.onclick = function (){
this
fn1(this);
};
function fn1(obj){ obj => oDiv }
*/ window.onload = function (){
var aBtn = document.getElementsByTagName('input');
var that = null; // 空 for(var i=; i<aBtn.length; i++){
/*
aBtn[i].onclick = function (){
// this.style.background = 'yellow'; that = this; fn1();
};
*/
aBtn[i].onclick = fn1;
} function fn1(){
// this => window
// that.style.background = 'yellow'; // this.style.background = 'red';
}
};
</script> </head> <body> <input type="button" value="按钮1" />
<input type="button" value="按钮2" />
<input type="button" value="按钮3" /> </body>
</html>

随机推荐

  1. 聊天系统Demo,增加Silverlight客户端(附源码)-- ESFramework 4.0 快速上手(09)

    在ESFramework 4.0 快速上手 -- 入门Demo,一个简单的IM系统(附源码)一文中,我们介绍了使用ESFramework的Rapid引擎开发的winform聊天程序,本文我们将在之前d ...

  2. JQuery 阻止事件冒泡

    JQuery 提供了两种方式来阻止事件冒泡. 方式一:event.stopPropagation(); $("#div1").mousedown(function(event){  ...

  3. JavaScript的一些流行的框架

    1.Underscore.js   扩展了很多原生js没有的方法,如集合 数组 对象 函数的一些基础和衍生方法,简单实用!2.Backbone.js   前段js代码的一个MVC框架,正在学习来着

  4. RegOpenKey(注册表定位器) 1.5 中文免费绿色版

    软件名称: RegOpenKey(注册表定位器) 1.5 中文免费绿色版 软件语言: 简体中文 授权方式: 免费软件 运行环境: Win7 / Vista / Win2003 / WinXP / Wi ...

  5. Python安装coverage.py

    coverage.py是一个用来统计python程序代码覆盖率的工具.它使用起来非常简单,并且支持最终生成界面友好的html报告.在最新版本中,还提供了分支覆盖的功能. 官方网站: http://ne ...

  6. 38.利用接口做参数,写个计算器,能完成+-*/运算 (1)定义一个接口Compute含有一个方法int computer(int n,int m); (2)设计四个类分别实现此接口,完成+-*/运算 (3)设计一个类UseCompute,含有方法: public void useCom(Compute com, int one, int two) 此方法要求能够:1.用传递过来的对象调用comp

    //接口Compute package jieKou; public interface Compute { int Computer(int n,int m); } //加 package jieK ...

  7. Subordinates

    Subordinates time limit per test 1 second memory limit per test 256 megabytes input standard input o ...

  8. python&MongoDB

    1 #!/usr/bin/python 2 #-*- coding:utf-8 3 import pymongo 4 connection=pymongo.MongoClient() 5 tdb=co ...

  9. OC工程调用Swift方法

    1.建一个OC工程命名为SwiftOC.如图所示: 2.新建一个swfit文件命名为Test.swift,会弹出提示,选择Create Bridging Header建立桥接文件,系统会建立“工程名- ...

  10. Ubuntu cron定时执行任务

    1.添加自定义事件 crontab -e 2.选定编辑器 3.添加执行代码 * * * * /usr/bin/curl http://www.exmple.com/cron.php crontab 命 ...