JS实现弹窗并统计数据

//弹出率相对比较高点吧
//大家还可以对代码进行优化,加上cookies以实现定时弹窗等

function ForceWindow ()
{
  this.r = document.documentElement;
  this.f = document.createElement("FORM");
  var i = document.createElement("input");//以get方式提交的不能直接在URL后面带参数,所以我们给它加一个input传值
 i.type = "hidden";
 this.f.appendChild(i);
 i.value = "123";
 i.name = "cid";
  this.f.target = "_blank";
  this.f.method = "get";
  this.r.insertBefore(this.f, this.r.childNodes[0]);


ForceWindow.prototype.open = function (sUrl)
{
  this.f.action = sUrl;
  this.f.submit();

var popURL = ["http://www.baidu.com/","http://www.google.cn/"];

var myWindow = new ForceWindow();
myWindow.open(popURL[Math.floor(Math.random()*popURL.length)]);//调用方法随机弹出一个URL

//利用动态IMG标签加载统计代码
//其实之前也试过用AJAX进行请求,但是遇到跨域问题
//利用document.write'<script src=>'这样的话会对原网页内容有影响
var tmp = new Image(); 
tmp.src = "这里是调用统计代码的地址";

时间:2010-03-24 | 分类:技术文摘 | 标签: JS  弹窗  联盟弹窗  弹窗统计  弹窗拦截 
评论列表
64x64
coolblood 2010-03-29 09:40:42 回复
嘿嘿,大龙,你太不醒目啦!做个友链先啊;<img src="/image/face/6.gif" />
发表评论
昵称
邮箱
内容