---
title: "简单的事件处理代码 from g.cn"
author: "muyu"
date: "2010-06-29T19:49:34Z"
tags: []
categories: ["Web前端"]
slug: "from-g-cn"
draft: false
lastmod: "2010-06-29T20:48:37Z"
id: 701996
url: "https://muyu.iteye.com/blog/701996"
---

[![](http://www.google.org.cn/wp-content/uploads/2010/06/screen-capture15-650x374.jpg)](http://www.google.org.cn/posts/google-china-icp-license-renewal-fail.html)

g.cn首页不再跳转了，放了一张图片，鼠标点击客户区，页面跳转到hk页面。

 

摘出该事件处理代码，以寄托google关闭g.cn的悲情！

 

 

```
    var gcn=gcn||{};
    gcn.listen=function(a,e,b){
        if(a.addEventListener){
            a.addEventListener(e,b,false)
        }else if(a.attachEvent){
            a.attachEvent('on'+e,b)
        }
    };
    gcn.redirect=function(){
        window.location='http://www.google.com.hk/webhp?hl=zh-CN&sourceid=cnhp'
    };

    gcn.listen(document, 'click', gcn.redirect);
```