Home >Web Front-end >HTML Tutorial >iframe page jump problem_html/css_WEB-ITnose

iframe page jump problem_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:21:211324browse

The java framework

has three pages: aaa.jsp, bbb,jsp, ccc.jsp
There is a frame in the aaa page, and when the link is clicked, the frame displays the bbb page
There is also a bbb page A frame that displays the ccc page when a link is clicked
The expected result is to display the contents of three pages in one window at the same time.

Now the actual result is that when you click the link in the first page aaa, the page of bbb is displayed normally, and then continue to click the link in the second page bbb, a problem occurs, the page of bbb is refreshed directly to the page of aaa Interface, that is, only the bbb page is displayed in the window

How to solve it?
If I add target="rightMain" to the link to bbb.jsp below, I can achieve the result I want in the original window, but it will open an additional window that displays the bbb page

as follows It is the code of aaa.jsp, and bbb.jsp
<script type="text/javascript">	function showDeatil(obj,url){		$("downMain").src=url;	}</script><body onload="">  <!--这是主页面aaa.jsp -->  <div style="width: 100%; height: 10%; float: left;">    <a id="sfcurrent1" href="#" target="downMain" onclick="showDeatil('1','bbb.jsp');">点击链接在下面的iframe中显示子页面</a>  </div>  <div style="overflow: visible; width: 100%; height: 90%; float: left; border-style: outset; border: 0px;">	<iframe style="border: 0px;" width="100%;" height="100%" frameborder="1"		id="downMain" name="rightMain" src=""></iframe>  </div></body> 

<script type="text/javascript">	function showDeatil1(obj,url){		$("rightMain").src=url;	}</script><body onload="">  <!--这是第二个子页面bbb.jsp -->  <div style="width: 3%; height: 100%; float: left;">    <a id="sfcurrent1" href="#" target="rightMain" onclick="showDeatil1('1','ccc.jsp');">点击链接在右边的iframe中显示第三个页面</a>  </div>  <div style="overflow: visible; width: 96%; height: 100%; float: left; border-style: outset; border: 0px;">	<iframe style="border: 0px;" width="100%;" height="100%" frameborder="1"		id="rightMain" name="rightMain" src=""></iframe>  </div></body> 

Reply to discussion (solution)

function showDeatil(obj,url ){
$("#downMain").get(0).src=url;
}

function showDeatil1(obj,url){
$("#rightMain") .get(0).src=url;
}
Is $ the $ of jquery?
Correct the error and remove the target, try

function showDeatil(obj,url){
$("#downMain").get(0).src=url;
}

function showDeatil1(obj,url){
$("#rightMain").get(0).src=url;
}
$ is the $ of jquery?
Correct the error, then remove the target, try
$ is document.getElementById("downMain")
Now there are two situations:
When there is no target, the bbb page will refresh to cover the entire window, that is to say, in the window, the bbb page and the ccc page in the Bbb frame
are displayed. When there is a target, 3 pages can be displayed normally in one window, but a new window is opened to display bbb and ccc page

c76a95286649e8d9c7f51f69c7517d4a065276f04003e4622c4fe6b64f465b88
It turns out that I set the height of the iframe to 200%, and the iframe filled the window

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn