3秒钟自动条状到指定页面,以post方式向一个页码提交参数

<script>

    $(function () {
        $("#sub").click(function () {
            post('http://www.test23.com:81/login.aspx', { username: $("#username").val(), password: $("#pwd").val() });
        });
    });
    function post(URL, PARAMS) {
        var temp = document.createElement("form");
        temp.action = URL;
        temp.method = "post";
        temp.setAttribute("target", "_blank");
        temp.style.display = "none";
        for (var x in PARAMS) {
            var opt = document.createElement("input");
            opt.setAttribute("type", "password");
            opt.name = x;
            opt.value = PARAMS[x];
            temp.appendChild(opt);
        }
        document.body.appendChild(temp);
        temp.submit();
        return temp;
    }

    function timego() {
        var timespan = document.getElementById('times');
        if (timespan.innerHTML == 0) {
            window.history.go(-33);
            return false;
        }
        timespan.innerHTML = timespan.innerHTML - 1;
    }
    window.setInterval('timego()', 1000);
   
</script>

posted on 2011-12-21 17:21  larryle  阅读(184)  评论(0)    收藏  举报