Javascript新手在这里,
我有一个带按钮的代码
<a href="#" onclick="javascript:popoutPlayer();">Popout</a>
触发window.open调用
function popoutPlayer(){
window.open('popout.html', 'popout', 'width=645, height=363');
}
打开一个新窗口,我想调整窗口宽度,当我这样做时,我希望宽度保持不变,但要改变为800的高度
我一直在使用此代码
<script type="text/javascript">
var rtime = new Date();
var timeout = false;
var delta = 200;
$(window).resize(function() {
rtime = new Date();
if (timeout === false) {
timeout = true;
setTimeout(resizeend, delta);
}
});
function resizeend() {
if (new Date() - rtime < delta) {
setTimeout(resizeend, delta);
} else {
timeout = false;
//alert('Done resizing');
var windowWidth = $(window).width();
var windowHeight = $(window).height();
windowHeight = 800;
window.resizeTo($(window).width(), windowHeight);
}
}
</script>
但是当弹出窗口弹出高度变为800时,宽度会每200毫秒变小和变小。
我做错了什么?