2010-11-09 96 views
0

我点击了一个window.open函数调用,打开一个.swf albumplayer。更改window.open的标题

var win = null; 
function NewWindow(wizpage, wizname, w, h, scroll){ 
LeftPosition = (screen.width) ? (screen.width-w)-8 : 0; 
TopPosition = (screen.height) ? (screen.height-h)/2 : 0; 
settings = 'height=' + h + ',width=' + w + ',top= 100,' + TopPosition + ',left=' + LeftPosition + ',scrollbars=' + scroll + ',resizable'; 
win = window.open(wizpage, wizname, settings); 
} 

我想改变打开的窗口标题,它有一些有意义的标题(常数“相册播放器”什么的就可以了),所以不使用默认的文件名/应用-shockwave ...文本。

感谢您的帮助。

回答

2

试试这个

var win = null; 
function NewWindow(wizpage, wizname, w, h, scroll){ 
    LeftPosition = (screen.width) ? (screen.width-w)-8 : 0; 
    TopPosition = (screen.height) ? (screen.height-h)/2 : 0; 
    settings = 'height=' + h + ',width=' + w + ',top= 100,' + TopPosition + ',left=' + LeftPosition + ',scrollbars=' + scroll + ',resizable'; 
    win = window.open(wizpage, wizname, settings); 
    win.document.title = "your new title"; 
} 
+0

非常感谢,但不幸的是,它不能很好地工作,一会儿标题出现,但之后它会用swf名称重写。 :-(例如http://mind-jart.baksagaspar.com/mindkiller/ben-garbo/(底部,专辑播放器) – Gas 2010-11-10 08:40:16

8

然后把它给onload事件:

win.onload = function() { this.document.title = "your new title"; } 
0
function fnDurationPrint(displayText, dateText) { 
      var WindowObject = window.open('', "DurationText", "width=430,height=250,top=200,left=250,toolbars=no,scrollbars=yes,status=no,resizable=no"); 
      WindowObject.document.writeln("<li>" + displayText + "</li>"); 
      WindowObject.document.title = "Duration Text of " + dateText; 
     } 

//WindowObject.document.title =必须始终在所有的代码后,最后一个javascript函数