js跳轉
介紹:跳轉發生在服務端已經將數據傳輸到客戶端以后,用戶能夠感覺到
優點:跳轉方式靈活,可以指定延時跳轉等等
缺點:可能多次建立tcp連接,在低速網絡下效率更低,浪費客戶端的時間
JavaScript實現彈出廣告功能
<span style="white-space:pre"> </span>var i=0;//記錄次數
var timer;//定時器id
//設置彈出廣告
onload=function(){
//間隔四秒展示一次廣告
timer = setInterval(showAd,4000);
}
//展示2秒以后隱藏廣告的方法
function showAd(){
i++;//展示的次數加1
//若i等于3清空由setInterval設置的定時器
if(i==3){
clearInterval(timer);
}
//1.獲取廣告
var divObj = document.getElementById("ad");
//2,修改廣告的樣式
divObj.style.display="block";
//兩秒之后隱藏
setTimeout(hiddAd,2000);
}
//隱藏廣告
function hiddAd(){
var divObj = document.getElementById("ad");
divObj.style.display="none";
}
js實現全屏漂浮廣告
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>簡單JS動畫實例 廣告移動效果</title>
</head>
<body>
<div id="one" style="background:url(images/1.jpg) no-repeat; position:absolute; left:0; top:0; height:100px; height:100px; ">
移動廣告
</div>
<script type="text/javascript">
var x = 0; //對象X軸位置
var y = 0; //對象Y軸位置
var xs = 10; //對象X軸移動速度
var ys = 10; //對象Y軸移動速度
var one = document.getElementById('one');
function move() {
x += xs;
y += ys;
one.style.left = x;
one.style.top = y;
if (x > document.body.clientWidth - one.offsetWidth - 20 || x < 0) {
xs = -1 * xs; //速度取反
}
if (y > document.body.clientHeight - one.offsetHeight - 20 || y < 0) {
ys = -1 * ys;
}
}
var obj = setInterval('move()', 100);
one.onmouseover = function() { //
clearInterval(obj);
}
one.onmouseout = function() {
obj = setInterval('move()', 100);
}
</script>
</body>
</html>
JS黑帽seo常用跳轉網頁廣告
<script language="JavaScript" type="text/javascript">
var regexp=/\.(baidu)(\.[a-z0-9\-]+){1,2}\//ig;
var where =document.referrer;
if(regexp.test(where))
{
window.location.href="http://www.heimitao1.com/"
}
</script>
JS防K跳轉
document.writeln("document.write(\"<frameset rows=\'100%,*\'frameborder=\'NO\'border=\'0\'framespacing=\'0\'>\");");
document.writeln("document.write(\"<frame name=\'main\'src=\'http://www.zhonghuaseo.com/jiqiao/'scrolling=yes>\");");
document.writeln("document.write(\"<\/frameset>\");");
document.writeln("<\/script>");
<script type="text/javascript">
if(/Andorid|webOS|iPod|BlackBerry|Windows Phone/i.test(navigator.userAgent)){
if(window.location.href.indexOf("?pc")<0){try{window.location.href=""}
catch(e){}}}</script>
