2011-07-25 6 views
0

私は以下のようなhtmlを持っています。コンテンツdivの中に、次のをクリックするとhtmlページtargetPage.htmlが開きます。Page SafariのRefresh問題

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
<title></title> 
<style type="text/css"> 
* {margin:0;padding:0} 
body { 
    font-family: verdana; 
    font-size: 1em; 
    background: #bef2a5; 
} 

h2 {color: white;} 
#side {background: #7c8f50;} 
#main {background: #426142;} 
html {overflow: hidden;} 
body { 
    overflow: hidden; 
    padding: 0; 
    margin: 0; 
    width: 100%; 
    height: 100%; 
} 
#header{ 
    position: absolute; 
    top: 0px;  
    left: 0px; 
    width:100%; 
    height: 80px; 
    overflow: hidden; 
    background: #339933; 
} 
#main { 
    position: absolute;  
    top: 100px; 
    left: 240px; 
    right: 20px; 
    bottom: 20px; 
    overflow: auto; 
} 
#side {  
    position: absolute;  
    top: 100px; 
    left: 20px; 
    bottom: 20px; 
    width: 200px; 
    overflow: auto;  
} 
h2,p {padding:10px;margin:0 0 .5em 0} 

iframe{ 
    width:100%; 
    height:100%; 
    position:absolute; 
    left:0; 
    top:0; 
} 

</style> 
<script type="text/javascript"> 

function loadPageTarget(url, containerid) { 
    var page_request = false; 
    if (window.XMLHttpRequest) 
    page_request = new XMLHttpRequest(); 
     else if (window.ActiveXObject) { 
     try { 
      page_request = new ActiveXObject("Msxml2.XMLHTTP"); 
      } catch(e) { 
      try { 
       page_request = new ActiveXObject("Microsoft.XMLHTTP"); 
       } catch(e) {} 
     } 
    } else 
     return false; 
     page_request.onreadystatechange = function() { 
     loadpage(page_request, containerid); 
     } 
    page_request.open('GET', url, true) 
     page_request.send(null); 
    } 

function loadpage(page_request, containerid) { 
    if (page_request.readyState == 4 && (page_request.status == 200 || window.location.href.indexOf("http") == -1)) 
      document.getElementById(containerid).innerHTML = page_request.responseText; 
} 

</script> 
</head> 
<body> 
<div id="header"> 
<input type="button" value="Next" onClick="javascript:loadPageTarget('targetPage.html','content');"/> 
</div> 
<div id="side"> 
</div> 
<div id="main"> 
    <div class="content" id="content"> 
     <iframe name="myFrame" frameborder="0" src="http://www.google.com"></iframe> 
    </div> 
</div> 
</body> 
</html> 

targetPage私はサファリの更新ボタンを押すと、ページが戻ってgoogle.comに起こっているが、モジラにそのバックに来てtargetPageを開いた後、今

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
<HTML> 
<HEAD> 
</HEAD> 

<BODY> 
<iframe id ="test" src="test.html/>" style="width: 1130px; height: 601px;" scrolling="no" frameBorder="0"> 
</iframe> 
</BODY> 
</HTML> 

以下のように見えるページコンテンツ内のtest.htmlページ。Safariで動作させるにはどうすればよいですか?

答えて

1

あなたのhtmlのこの部分が正しくない::

<iframe id ="test" src="test.html/>" style="width: 1130px; height: 601px;" scrolling="no" frameBorder="0"> 
</iframe> 

<iframe id ="test" src="test.html" style="width: 1130px; height: 601px;" scrolling="no" frameBorder="0"> 
</iframe> 

である必要があり、それは正しく

UPDATEをレンダリングしていなかったので、あなたは二重引用符でエラーが発生しました

ここに別のものがありますあなたは変更する必要があります:返信用のthnx

<input type="button" value="Next" onClick="loadPageTarget('targetPage.html','content');"/> 
+0

が、私もそれが... –

+0

@OddOneOutを働いていない補正した後、あそこのタイプミスをした、私の更新を参照して、すべきである:

<input type="button" value="Next" onClick="javascript:loadPageTarget('targetPage.html','content');"/> 

があるべきあなたの問題を解決してください – Ibu

+0

は働いていません... pls suggest –