iframe的在服务端问题
<%@ Page language="c#" Codebehind="WebForm5.aspx.cs" AutoEventWireup="false" Inherits="WebApplication1.WebForm5" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm5</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<iframe id="text" name="text" runat="server"></iframe>
<asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 144px; POSITION: absolute; TOP: 192px" runat="server"
Text="Button" Width="104px" Height="24px"></asp:Button>
<script language="javascript">
text.document.designMode="On";
</script>
</form>
</body>
</HTML>
------------------------
后台
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace WebApplication1
{
/// <summary>
/// WebForm5 的摘要说明。
/// </summary>
public class WebForm5 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.HtmlControls.HtmlGenericControl text;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Button1_Click(object sender, System.EventArgs e)
{
string str="<b>1.货物在出库时,分两个过程:<p>";
Response.Write ("<script>document.all(text).document.body.innerHTML='"+ str +"'</script>");
}
}
}
我想在后台编码,在iframe中显示"str="<b>1.货物在出库时,分两个过程:<p>";" 我写了如下语句
string str="<b>1.货物在出库时,分两个过程:<p>";
Response.Write ("<script>document.all(text).document.body.innerHTML='"+ str +"'</script>");
这句
Response.Write ("<script>document.all(text).document.body.innerHTML='"+ str +"'</script>");
提示错误 document.all(text)对象为空或没有定义
我试 过 document.all['text'] /document.all.text. 都是这个错误提示
该怎样修改