如题,一个页面(main.aspx)嵌入了一个iframe(file.aspx)页面,在 file.aspx 页面里传值给main.aspx页面的TextBox1,能传过去,同样的代码传值给 Fckeditor 就是不行,贴出代码来,高手帮忙看看。。
      main.aspx
--------------------------------------------------------------------------------------
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<!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>
</head>
<body>
    <form id="Post_form" runat="server">
    <div>
       <iframe src="file.aspx"  style="width: 347px; height: 46px" frameborder="0" height="30" scrolling="no"></iframe>
        &nbsp;<br />       <asp:TextBox ID="TextBox1" runat="server" Height="156px" Width="344px" TextMode="MultiLine"></asp:TextBox>&nbsp;</div>
       <fckeditorv2:fckeditor id="p_Content" ToolbarSet="Basic" runat="server" basepath="FCKeditor/" height="150px" Width="350px"></fckeditorv2:fckeditor>
        <br />
        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
        <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Button" /><br />
    </form>
</body>
</html>-----------------------------------------------------------------------------------------   file.aspx
<!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>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="添加" />
    
    </div>
    </form>
</body>
</html>file. cs 文件
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;public partial class file : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string imgfile = TextBox1.Text;
        if (imgfile != null)
        {
            Response.Write("<script>if(parent.Post_form.p_Content.createTextRange && parent.Post_form.p_Content.caretPos)");
            Response.Write("{var caretPos = parent.Post_form.p_Content.caretPos;");
            Response.Write("caretPos.text =caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?'" + imgfile + "' + ' ' : '" + imgfile + "';}");
            Response.Write("else{parent.Post_form.p_Content.value  += '" + imgfile + "';}</script>");
        }
    }
 
}