2015-03-03 92 views
0

我有框架集框架如下:如何從另一個框架中打開一個框架中的特定html?

<frameset rows="75%,25%"> 
    <frameset cols="20%,80%"> 
     <frame src="TreeGroup.jsp" name="left" id="f1"/> 
     <frame src="DisplayMap.jsp" name="top" id="f2"/> 
    </frameset> 
    <frame src="Tabs.jsp" name="bottom"/> 
</frameset> 

f1我有context menu選項,這樣如果我點擊幀f1AddVehicle選項應該在幀2(f2)打開新的JSP/HTML。因此,在Javascript功能我不喜歡這樣,

function addVehicle() 
{ 
    alert("In addVehicle"); 
//parent.top.location.href="http://localhost:8080/ITS_Server/Vehicle_Registration.jsp"; 
    top.frames['top'].location.href = "http://localhost:8080/ITS_Server/Vehicle_Registration.jsp?gname="+grp_name+"&did="+'<%=uid%>', "toolbar=yes, scrollbars=yes, resizable=yes, top=100,bottom=200, left=200, width=900, height=500"; 

} 

在這裏,我面對的是,top.frames['top'].location.href工作正常只有當我刪除所有的參數網址,並它不是在它在打開f2框架中打開的問題完整的窗口。如何解決這個問題,任何人都可以在這裏幫助我。

回答

0

我認爲你應該嘗試設置幀f2的來源,而不是設置location.href屬性。 類似如下:

var frmap = document.getElementById("f2"); 
frmap.src = "new url"; 
+0

它的錯誤,告訴'不能設置null' – Raghu 2015-03-03 11:00:02

+0

我想從'TreeGroup.jsp'調用另一個頁面,在這裏ID'f2'是其中還有一個文件的屬性SRC只有我在上面提到的代碼,那麼'gwtElementById()'如何在'TreeGroup.jsp'頁面中工作 – Raghu 2015-03-03 11:03:11

+0

只需要嘗試一下:top.window.frames [「f2」] – user3171825 2015-03-03 11:13:31

相關問題