Javascript Safari中的页面刷新问题

Javascript Safari中的页面刷新问题,javascript,jquery,html,safari,Javascript,Jquery,Html,Safari,我有一个如下所示的html。在content div中,单击next,我们将打开一个html页面targetPage.html <!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" > <h

我有一个如下所示的html。在content div中,单击next,我们将打开一个html页面targetPage.html

<!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>

*{边距:0;填充:0}
身体{
字体系列:verdana;
字号:1em;
背景:#bef2a5;
}
h2{颜色:白色;}
#侧{背景:#7c8f50;}
#主要{背景:#426142;}
html{溢出:隐藏;}
身体{
溢出:隐藏;
填充:0;
保证金:0;
宽度:100%;
身高:100%;
}
#标题{
位置:绝对位置;
顶部:0px;
左:0px;
宽度:100%;
高度:80px;
溢出:隐藏;
背景#339933;
}
#主要{
位置:绝对位置;
顶部:100px;
左:240px;
右:20px;
底部:20px;
溢出:自动;
}
#边{
位置:绝对位置;
顶部:100px;
左:20px;
底部:20px;
宽度:200px;
溢出:自动;
}
h2,p{填充:10px;边距:0.5em0}
iframe{
宽度:100%;
身高:100%;
位置:绝对位置;
左:0;
排名:0;
}
函数loadPageTarget(url,containerid){
var page_request=false;
if(window.XMLHttpRequest)
page_request=new XMLHttpRequest();
else if(window.ActiveXObject){
试一试{
page_request=newActiveXObject(“Msxml2.XMLHTTP”);
}捕获(e){
试一试{
page_request=newActiveXObject(“Microsoft.XMLHTTP”);
}捕获(e){}
}
}否则
返回false;
page_request.onreadystatechange=函数(){
装入页(请求页,集装箱ID);
}
页面请求。打开('GET',url,true)
页面_请求发送(空);
}
函数加载页(请求页,容器ID){
if(page_request.readyState==4&&(page_request.status==200 | | | window.location.href.indexOf(“http”)==1))
document.getElementById(containerid).innerHTML=page\u request.responseText;
}
页面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>


现在,在打开targetPage之后,如果我在safari上按下刷新按钮,则该页面将返回到google.com,但在mozilla上,它将返回内容中的test.html页面。您知道如何在safari中使用它吗?

这部分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>

双引号有错误,所以无法正确渲染

更新:

以下是您需要更改的另一项内容:

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

应该是:

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

Thnx的回复,但我在那里打错了,即使在更正后它也不起作用。。。