如果光用javascript来达到这功能可能不行,比如下面的例子:
你只能在sample.php静态的指定一个title,如果你用的是脚本的话,你可以试着设一个超全局变量,比如GET 或 SESSION
window.open("sample.php?title=Mytitle",null,"height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");
/******sample.php*******/
<head>
<title><?php=$_GET['YourSetTitle']?></title>
<meta http-equiv="Cache-Control" content="max-age=30"/>
<meta http-equiv="content-type" content="text/html" charset="GB2312">
你只能在sample.php静态的指定一个title,如果你用的是脚本的话,你可以试着设一个超全局变量,比如GET 或 SESSION
window.open("sample.php?title=Mytitle",null,"height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");
/******sample.php*******/
<head>
<title><?php=$_GET['YourSetTitle']?></title>
<meta http-equiv="Cache-Control" content="max-age=30"/>
<meta http-equiv="content-type" content="text/html" charset="GB2312">
http://www.cfedu.net/ads/pmzx/
aaa=window.open("4.htm");
setTimeout("HB()",1000)
function HB()
{
aaa.document.title="天外水火"
}
</script>
主要问题出在要等到子窗口加载完之后才可以操作,这样的代码最好写在子窗口BODY的onload里,如果非要写在父窗口,就只有上面这样了
win.document.title = "这是标题";
aaa.onload = function(){
aaa.document.title = "天外水火";
}
没办法,我只有在子窗口中加代码了:
document.title=opener.document.title;
这样子窗口获取父窗口的标题做为它的标题就可以了!
这样也可以