我使用Safari 6.0.5。的Javascript document.title時不工作在Safari
我打開一個新的空窗口,嘗試將標題更改爲「調試窗口」,沒有任何反應。隨着檢查功能檢查每10毫秒,它說的是window.document.title的「調試窗口」,還是新的窗口標題欄說,這是「無」。
var debug_window = window.open('', 'debug_window', 'height=200');
debug_window.document.title = 'Debug Window';
function check()
{
debugLog(1, 'title:' + debug_window.document.title);
if(debug_window.document) { // if loaded
debug_window.document.title = "debug_window"; // set title
} else { // if not loaded yet
setTimeout(check, 10); // check in another 10ms
}
}
check();
在DEBUGLOG的輸出是:
17:35:04.558: title:
17:35:04.584: title:debug_window
這是怎麼回事錯在這裏,新的窗口仍然被稱爲「無」?
謝謝!
'debug_window.document.getElementsByTagName( 「標題」)[0] .childNodes [0] .nodeValue =「調試窗口」;';)或先創建標題元素,然後將其追加 – Givi
嘗試...... http://jsfiddle.net/GKDev/93QFk/ – Givi
@Givi,還在說在你的鏈接名字。 .. – MiiChiel