我有兩個HTML文件:index.html
和Page2.html
。
我在index.html
頁面有一個按鈕,名爲WWW_onclick()
。
如您所見,此功能打開Page2.html
並寫入「hello」。
問題是這個功能抹去了原來的Page2.html
,只寫「你好」。
JavaScript刪除第二頁的內容
有沒有辦法保留Page2.html
的內容並在其中添加其他文字,圖片或...?
function WWW_onclick()
{
document.location.href = "Page2.html";
document.write("hello");
}
重複:http://stackoverflow.com/questions/9280750/how-to-change-content-after-page-is-loaded- js – Quentin