在窗口弹出窗口中设置标题 [英] Set title in the window popup

查看:641
本文介绍了在窗口弹出窗口中设置标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在弹出窗口中设置标题?

Is it possible to set a title in the window popup?

我在javascript中有这个:

I have this in javascript:

var popup = window.open('......');
popup.document.title = "my title";

但这不起作用..但是看不到任何标题

but this does not work..still can't see any title

编辑:页面弹出窗口显示的是.aspx,它有一个标题标签,但仍然无法在弹出窗口中看到..

the page popup is displaying is .aspx and it HAS a title tag, but still can't see that on the popup window..

推荐答案

由于 popup.onload 似乎不起作用,这里有一个解决方法: http://jsfiddle.net/WJdbk/

Since popup.onload does not seem to work, here is a workaround: http://jsfiddle.net/WJdbk/.

var win = window.open('', 'foo', ''); // open popup

function check() {
    if(win.document) { // if loaded
        win.document.title = "test"; // set title
    } else { // if not loaded yet
        setTimeout(check, 10); // check in another 10ms
    }
}

check(); // start checking

这篇关于在窗口弹出窗口中设置标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆