87,993
社区成员
发帖
与我相关
我的任务
分享var ar = [
'http://union.163.com/gs2/union/adjs/6156432/16/3?link_id=614',
'http://union.163.com/gs2/union/adjs/6156432/12/3?link_id=567',
'http://union.163.com/gs2/union/adjs/6156432/11/4?link_id=416'
];
var obj = document.createElement('script');
obj.src = ar[Math.floor(Math.random() * 3)];
document.getElementsByTagName('body')[0].appendChild(obj);
$ar = array(
'http://union.163.com/gs2/union/adjs/6156432/16/3?link_id=614',
'http://union.163.com/gs2/union/adjs/6156432/12/3?link_id=567',
'http://union.163.com/gs2/union/adjs/6156432/11/4?link_id=416'
);
$k=array_rand($ar,1);
echo <<<html
<script type="text/javascript" src="$ar[$k]"></script>
html;
<!DOCTYPE HTML>
<html>
<head>
<meta charset="gb2312" />
<title></title>
</head>
<body>
<script>
var data = [
'http://union.163.com/gs2/union/adjs/6156432/16/3?link_id=614',
'http://union.163.com/gs2/union/adjs/6156432/16/3?link_id=567',
'http://union.163.com/gs2/union/adjs/6156432/16/3?link_id=416'
];
// 随机 0 1 2
var random = function(){
return Math.floor(Math.random() * 3);
};
var r = random();
var script = document.createElement('script');
script.src = data[r];
document.getElementsByTagName('head')[0].appendChild(script);
</script>
</body>
</html>