积极答复者
c#在本页面显示另一页面问题?

问题
答案
-
<%@ Page Language="C#" %> <!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 id="Head1" runat="server"> <title></title> </head> <body runat="server" id="Body1"> <script type="text/javascript" language="javascript"> function openhtml(iframesrc) { var d = document.getElementById('<%=ddl_department.ClientID %>') var u = d.options[d.selectedIndex].value window.frames["IFRAME1"].location.href = "../Excle/[部门]" + u + "]工作表.html" } </script> <form id="Form1" method="post" runat="server"> <br /> <asp:DropDownList ID="ddl_department" runat="server"> <asp:ListItem>1001</asp:ListItem> <asp:ListItem>1002</asp:ListItem> </asp:DropDownList> <asp:Button ID="Button1" runat="server" OnClientClick="openhtml();return false;" Text="Button" /> <br /> <iframe name="IFRAME1" frameborder="0" src='../Excle/[部门]1001]工作表.html' style="width: 100%;height: 100%"></iframe> </form> </body> </html>
【孟子E章】- 已标记为答案 myhmsdn 2009年5月9日 9:05
全部回复
-
孟老师,您看看这个网页中有个 框架“IFRAME1”其中显示的是一个静态页面
但是运行后页面的左下角报了一个脚本错误,是缺少标识符错误
<body runat="server" id="Body1">
<script type="text/javascript" language="javascript">
function openhtml(var iframesrc)
{
window.document.getElementById("IFRAME1").setAttribute("src","../Excle/[部门]1001]工作表.html");
}
</script>
<form id="Form1" method="post" runat="server">
<br />
<asp:DropDownList ID="ddl_department" runat="server">
<asp:ListItem>1001</asp:ListItem>
<asp:ListItem>1002</asp:ListItem>
</asp:DropDownList>
<asp:Button id="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
<br />
<iframe id="IFRAME1" runat="server" frameborder="0" src='../Excle/[部门]1001]工作表.html' style="WIDTH: 100%; HEIGHT: 100%" ></iframe>
</form>
</body>
</html>
msdn -
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="X200905091138.aspx.cs" Inherits="HTML_CSS_JAVASCRIPT_X200905091138" %> <!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></title> <script type="text/javascript" language="javascript"> function openhtml(url) { document.getElementById("IFRAME1").src = url; } </script> </head> <body> <form id="form1" runat="server"> <div> <input type="button" onclick='openhtml("http://social.microsoft.com/Forums/zh-CN/295/thread/0632347e-592b-48f0-8fe9-c29abe77bd0c");' value = "button" /> <br /> <iframe id="IFRAME1" frameborder="2px" src='about:balck' style="WIDTH: 500px; HEIGHT: 500px"></iframe> </div> </form> </body> </html>
知识改变命运,奋斗成就人生! -
<%@ Page Language="C#" %> <!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 id="Head1" runat="server"> <title></title> </head> <body runat="server" id="Body1"> <script type="text/javascript" language="javascript"> function openhtml(iframesrc) { var d = document.getElementById('<%=ddl_department.ClientID %>') var u = d.options[d.selectedIndex].value window.frames["IFRAME1"].location.href = "../Excle/[部门]" + u + "]工作表.html" } </script> <form id="Form1" method="post" runat="server"> <br /> <asp:DropDownList ID="ddl_department" runat="server"> <asp:ListItem>1001</asp:ListItem> <asp:ListItem>1002</asp:ListItem> </asp:DropDownList> <asp:Button ID="Button1" runat="server" OnClientClick="openhtml();return false;" Text="Button" /> <br /> <iframe name="IFRAME1" frameborder="0" src='../Excle/[部门]1001]工作表.html' style="width: 100%;height: 100%"></iframe> </form> </body> </html>
【孟子E章】- 已标记为答案 myhmsdn 2009年5月9日 9:05