Code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Get MSN ADS by xmlHttpRequest</title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="stefanie">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body style="margin-left:-10;margin-top:-10;">
<script type ="text/javascript" language ="javascript" >
var req; //定义变量,用来创建xmlhttprequest对象
function creatReq() // 创建xmlhttprequest,ajax开始
{
var url="http://rad.msn.com/ADSAdClient31.dll?GetAd=&PG=IMSCB2&AP=1007"; //要请求的服务端地址
//var url="http://www.google.cn"; //要请求的服务端地址
if(window.XMLHttpRequest) //非IE浏览器,用xmlhttprequest对象创建
{
req=new XMLHttpRequest();
}
else if(window.ActiveXObject) //IE浏览器用activexobject对象创建
{
req=new ActiveXObject("Microsoft.XMLHttp");
}
if(req) //成功创建xmlhttprequest
{
req.open("GET",url,true); //与服务端建立连接(请求方式post或get,地址,true表示异步)
req.onreadystatechange = callback; //指定回调函数
req.send(null); //发送请求
}
}
function callback() //回调函数,对服务端的响应处理,监视response状态
{
if(4 == req.readyState ) //请求状态为4表示成功
{
if(req.status==200) //http状态200表示OK
{
Dispaly(); //所有状态成功,执行此函数,显示数据
}
else //http返回状态失败
{
alert("服务端返回状态" + req.statusText);
}
}
else //请求状态还没有成功,页面等待
{
//document.getElementById ("div1").innerHTML ="数据加载中";
}
}
function Dispaly() //接受服务端返回的数据,对其进行显示
{
document.write(req.responseText);
}
creatReq();
</script>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Get MSN ADS by xmlHttpRequest</title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="stefanie">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body style="margin-left:-10;margin-top:-10;">
<script type ="text/javascript" language ="javascript" >
var req; //定义变量,用来创建xmlhttprequest对象
function creatReq() // 创建xmlhttprequest,ajax开始
{
var url="http://rad.msn.com/ADSAdClient31.dll?GetAd=&PG=IMSCB2&AP=1007"; //要请求的服务端地址
//var url="http://www.google.cn"; //要请求的服务端地址
if(window.XMLHttpRequest) //非IE浏览器,用xmlhttprequest对象创建
{
req=new XMLHttpRequest();
}
else if(window.ActiveXObject) //IE浏览器用activexobject对象创建
{
req=new ActiveXObject("Microsoft.XMLHttp");
}
if(req) //成功创建xmlhttprequest
{
req.open("GET",url,true); //与服务端建立连接(请求方式post或get,地址,true表示异步)
req.onreadystatechange = callback; //指定回调函数
req.send(null); //发送请求
}
}
function callback() //回调函数,对服务端的响应处理,监视response状态
{
if(4 == req.readyState ) //请求状态为4表示成功
{
if(req.status==200) //http状态200表示OK
{
Dispaly(); //所有状态成功,执行此函数,显示数据
}
else //http返回状态失败
{
alert("服务端返回状态" + req.statusText);
}
}
else //请求状态还没有成功,页面等待
{
//document.getElementById ("div1").innerHTML ="数据加载中";
}
}
function Dispaly() //接受服务端返回的数据,对其进行显示
{
document.write(req.responseText);
}
creatReq();
</script>
</body>
</html>
MSN 的广告脚本,客户端会根据live帐号属性去请求不同的广告脚本(地域不同)。这个是地区为中国的脚本。
Code
<script type="text/javascript">
//<![CDATA[
function getRADIds()
{
return{"adid":"1566165","pid":"5808530","targetid":"8084131"};
}
if(typeof(inDapIF) != "undefined" && parent._dapUtils.is_ie5up)
{
parent.dap_Resize(document.body.id, 234, 60);
document.onreadystatechange=startRenderAd_805307295;document.close();
}
else
{document.write(renderAd_805307295());}
function startRenderAd_805307295()
{
if (document.readyState=="complete")
{
var dapIfs = document.body.id;
var childdapIfs = dapIfs + 'Child';
var ifrm = document.createElement("IFRAME");
ifrm.id = childdapIfs;
ifrm.height = parent.document.all[dapIfs].height;
ifrm.width = parent.document.all[dapIfs].width;
ifrm.scrolling = "no";
ifrm.frameBorder = 0;
document.body.insertAdjacentElement("afterBegin",ifrm);
writeinDapIF_805307295(ifrm, dapIfs);
parent.document.all[dapIfs].insertAdjacentElement('beforeBegin', ifrm);
parent.dap_Resize(document.body.id, 0, 0);
}
}
function writeinDapIF_805307295(ifrm, dapIfs)
{
var s = '<html><head><title>Advertisement</title></head><body id="' + dapIfs + 'Child" leftmargin="0" topmargin="0"><scr'+'ipt type="text/javascript">var inDapIF=true;';
if(document.domain && parent.location.hostname!=document.domain)
{s += 'document.domain="' + document.domain + '";';}
if (typeof(inDapMgrIf) != "undefined"){s +=' var inDapMgrIf=true;';}
s+= 'window.setTimeout("document.close();",30000);';
s+= '</scr'+'ipt>';
var renderAdCode = renderAd_805307295();
renderAdCode = renderAdCode.replace(/\n/g,"\\n");
renderAdCode = renderAdCode.replace(/'/g,"\\\'");
s+= renderAdCode;s+='</body></html>';
ifrm.src = "javascript:void(document.write('" + s + "'));";}
function renderAd_805307295()
{
var adCode_805307295=new Array();
adCode_805307295.push('<!--AdForward Begin:-->\n');
adCode_805307295.push('<iframe marginheight="0" marginwidth="0" frameborder="0" width="234" height="60" scrolling="no" src="http://msn.allyes.com/main/adfshow?user=MSN|Messenger|IMSCHI_CNZHS_MESGRMAINWIND_BAN234X60_I3_others&db=msn&border=0&local=yes"></iframe>\n');
adCode_805307295.push('<!--AdForward End-->\n');
var s = adCode_805307295.join('');
return s; }
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
function getRADIds()
{
return{"adid":"1566165","pid":"5808530","targetid":"8084131"};
}
if(typeof(inDapIF) != "undefined" && parent._dapUtils.is_ie5up)
{
parent.dap_Resize(document.body.id, 234, 60);
document.onreadystatechange=startRenderAd_805307295;document.close();
}
else
{document.write(renderAd_805307295());}
function startRenderAd_805307295()
{
if (document.readyState=="complete")
{
var dapIfs = document.body.id;
var childdapIfs = dapIfs + 'Child';
var ifrm = document.createElement("IFRAME");
ifrm.id = childdapIfs;
ifrm.height = parent.document.all[dapIfs].height;
ifrm.width = parent.document.all[dapIfs].width;
ifrm.scrolling = "no";
ifrm.frameBorder = 0;
document.body.insertAdjacentElement("afterBegin",ifrm);
writeinDapIF_805307295(ifrm, dapIfs);
parent.document.all[dapIfs].insertAdjacentElement('beforeBegin', ifrm);
parent.dap_Resize(document.body.id, 0, 0);
}
}
function writeinDapIF_805307295(ifrm, dapIfs)
{
var s = '<html><head><title>Advertisement</title></head><body id="' + dapIfs + 'Child" leftmargin="0" topmargin="0"><scr'+'ipt type="text/javascript">var inDapIF=true;';
if(document.domain && parent.location.hostname!=document.domain)
{s += 'document.domain="' + document.domain + '";';}
if (typeof(inDapMgrIf) != "undefined"){s +=' var inDapMgrIf=true;';}
s+= 'window.setTimeout("document.close();",30000);';
s+= '</scr'+'ipt>';
var renderAdCode = renderAd_805307295();
renderAdCode = renderAdCode.replace(/\n/g,"\\n");
renderAdCode = renderAdCode.replace(/'/g,"\\\'");
s+= renderAdCode;s+='</body></html>';
ifrm.src = "javascript:void(document.write('" + s + "'));";}
function renderAd_805307295()
{
var adCode_805307295=new Array();
adCode_805307295.push('<!--AdForward Begin:-->\n');
adCode_805307295.push('<iframe marginheight="0" marginwidth="0" frameborder="0" width="234" height="60" scrolling="no" src="http://msn.allyes.com/main/adfshow?user=MSN|Messenger|IMSCHI_CNZHS_MESGRMAINWIND_BAN234X60_I3_others&db=msn&border=0&local=yes"></iframe>\n');
adCode_805307295.push('<!--AdForward End-->\n');
var s = adCode_805307295.join('');
return s; }
//]]>
</script>