2015-04-26 46 views
0

我有一個名爲「Generate Schedule」的按鈕,當我點擊這個按鈕時,它將在一個類中運行一個名爲「schedule()」的方法,並且這個方法將在內部運行另一個方法在另一個類中稱爲「display()」。 「display()」方法將生成一個html文件作爲輸出,然後必須在新窗口中打開以顯示結果。 點擊按鈕後,如何讓窗口彈出html文件內容?window.open不顯示指定的路徑

下面是代碼的JSP文件

<% FYPScheduler f = new FYPScheduler(); %> 
<script type="text/javascript"> 
....... 
function callSchedule() 
{ 

    <% 
     f.schedule(); 
    %> 
    window.open("file:///Users/nonya_000/Documents/SeniorProject (1)/SeniorProject/schedule.html"); 
} 
....... 
</script> 
....... 
<button name="ThisButton" onclick="callSchedule()"> Generate Schedule </button> 

)的一部分我試圖用window.open(,當我點擊按鈕彈出一個新窗口,但它是空的。幫幫我?

+0

如果您在彈出窗口中右鍵單擊並轉到屬性,它將加載哪個網址? – dman2306

回答

0

請確保您的URL參考是正確的 - 打開瀏覽器並嘗試轉到file:/// Users/nonya_000/Documents/SeniorProject(1)/SeniorProject/schedule.html,因爲您已經參考了...如果它是空白頁面,那麼您知道schedule.html文件中的問題或者對該文件的URL引用是不正確的。