js的一些代码…

获取请求的参数

例:VisitPhoto.aspx?imgurl=http://s.cn.bing.net/az/hprichbg/rb/BottlenoseDolphinSurface_ZH-CN10113390118_1366x768.jpg

//预备
var Request = {
    QueryString: function (item) {
        var svalue = location.search.match(new RegExp("[\?\&]" + item + "=([^\&]*)(\&?)", "i"));
        return svalue ? svalue[1] : svalue;
    }
}
//使用
Request.QueryString("imgurl");

弹出独立窗口

//参数:地址、样式自设
function openWinPop(url) {
    var nWinLeft = (screen.width - 870) / 2;
    var nWinTop = (screen.height - 570) / 2;
    var win_style = "menubar=no,toolbar=no,location=no,directories=no,status=yes,resizable=yes,scrollbars=yes"
        + ",width=830,height=554,top=" + nWinTop + ",left=" + nWinLeft;
    window.open(url, "", win_style);
}

未完待续。。。

posted @ 2013-07-16 13:36  不是豆豆  阅读(306)  评论(0编辑  收藏  举报
友情链接:迷途