2010-11-09 95 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函數