Iframe 不刷新的问题. 当涉及到与数据库交互时. 用Button不能更新IFrame 好像有缓存在浏览器中, 用<a> 就没问题了

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Test_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <style type="text/css">
        #myframe
        {
            width: 841px;
            height: 419px;
        }
    </style>
<script language="javascript" type="text/javascript">
// <!CDATA[

function Button1_onclick() {
    var myframe = document.getElementById("myframe");
    myframe.src = "../Code_Project/Code_Project_Repeater.aspx";
    //window.opener.location.reload();
    //this.location = this.location;

    //Code_MainTableParameter_Repeater_TableCode_.aspx
}

function Button2_onclick() {
    //
    var myframe = document.getElementById("myframe");
    //this.location = this.location;

    myframe.src = "../Code_DatabaseDataType/Code_DatabaseDataTypeRepeater.aspx";
}

// ]]>
</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
        <input id="Button1" type="button" value="button" onclick="return Button1_onclick()" />
       
        <input id="Button2" type="button" value="button" onclick="return Button2_onclick()" />
        <a href="../Code_Project/Code_Project_Repeater.aspx" target="myframe">1</a>
        <a href="../Code_DatabaseDataType/Code_DatabaseDataTypeRepeater.aspx" target="myframe">2</a>
        <br />
       
        <iframe id='myframe' name='myframe'>
           
        </iframe>
        </div>
    </form>
</body>
</html>

posted @ 2009-07-01 23:21  Ken-Cai  阅读(562)  评论(1编辑  收藏  举报