js 打开新页面多种方法

1. window.location 法,代码如下

<body οnlοad="window.location='http://xxxxx';"></body>

2. 框架法,代码如下

<frameset cols="100%,*">

<frame src="http://zuo.ai.xiao.blog.163.com/blog/http://xxxxx" scrolling="auto">

</frameset>

其中scrolling参数值得注意,合理使用可加强隐蔽性。Cols参数可根据自己的实际情况作更改。

3. META标志法,代码如下

<META HTTP-EQUIV="Refresh" CONTENT="0;URL= http://xxxxx">

其中CONTENT后面的阿拉伯数字是代表过几秒中钟转入目标网页。

4. iframe内帧法

<iframe src="http://zuo.ai.xiao.blog.163.com/blog/http://xxxxx" width="0" height="0" frameborder="0">

5.

在window.open()函数中增加一个参数,将target设置为‘self’,

即改为使用: window.open('link','_self'); 等同window.location.href="http://zuo.ai.xiao.blog.163.com/blog/link"

6.

<a   href="http://zuo.ai.xiao.blog.163.com/blog/# "   οnclick= "window.showModalDialog( 'link') "> 点击 </a>

7.

function   replyMessage(id)

            {

                var   win = window.open('Reply.aspx?originMessage= '+id,'_blank');

                if   (win == null)

                    window.alert( "请不要启用弹出式窗口拦截 " );

            }

8.

window._open=window.open;

window.open=function(sURL,sName,sFeatures,bReplace){

if(sName==undefined){sName="_blank"};

if(sFeatures==undefined){sFeatures=""};

if(bReplace==undefined){bReplace=false};

var win=window._open(sURL,sName,sFeatures,bReplace);

if(!win){

    alert('天啦!你的机器上竟然有软件拦截弹出窗口耶,好讨厌哦,人家不来了啦!快去掉嘛~~555~');

    return false;

}

return true;

}





//for example:
var popWin = function(url,name,options){//弹出窗口,options是个对象
            options = options instanceof Object ? options : {};
            var height = options.height || window.screen.height-110;
            var width = options.width || window.screen.width/2;
            var top = options.top || 0;
            var left = options.left || width/2;
            window.open(url,name,'height='+height+',width='+width+',top='+top+',left='+left)
        }
popWin(‘http://www.xxx.com/callback.html’,'callback');


//callback.html

<script type="text/javascript" src="/style/js/jquery-1.10.2.min.js"></script>

<script type="text/javascript">
//关闭当前窗口
var closeWindow = function(){
    window.opener=null;
    window.open('','_self');
    window.close();    
}
var con = window.opener.document.getElementById("step3");
con.setAttribute('status',3);
con.className = 'move finish bc cp tc f14 step3Move graybtn';
$(con).text('已关联');
window.setTimeout("closeWindow()", 50);
</script>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值