日期:2014-05-17  浏览次数:20457 次

asp.net中怎样通过Button按钮将一个网页定向到一个iframe中?
asp.net中怎样通过Button按钮将一个网页定向到一个iframe中?请各位大侠帮忙,很急啊,如果有其他方法也可推荐。谢谢……(声明:本人学艺不精)

------解决方案--------------------
<%@ Page Language="C#" Debug="true" %>

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

protected void Button1_Click(object sender, EventArgs e)
{
Response.Write("ok");
}

protected void Page_Load(object sender, EventArgs e)
{
Page.Form.Target = "aa";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
</head>
<body>
<form id="form1" runat="server">
<iframe name="aa"></iframe>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
</form>
</body>
</html>

------解决方案--------------------
this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "", "document.getElementById('frmId').src='http://www.baidu.com';", true);