如题,一个页面(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>
<br /> <asp:TextBox ID="TextBox1" runat="server" Height="156px" Width="344px" TextMode="MultiLine"></asp:TextBox> </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>");
}
}
}
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>
<br /> <asp:TextBox ID="TextBox1" runat="server" Height="156px" Width="344px" TextMode="MultiLine"></asp:TextBox> </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>");
}
}
}
解决方案 »
- 怎么用递归实现这样的效果啊
- 无法将位于索引 11 处的 Unicode 字符 \uD846 转换为指定的代码页。
- 提供写入Cookie方式,求注销删除Cookie方法.马上结
- 请帮帮我。DataBinding:“System.Data.DataRowView”不包含名为“ID”的属性。
- repeater怎么控制分页?
- 请问如何防止如!!!!!!!!!!!!这样的东西可以强制换行呢?
- 怎样在程序中实现调用AJAX刷新
- 求完整的论坛源码和博客源码,c#的,谢谢!!
- Crystal Report的打印问题
- 自定义类的奇怪问题?
- ajaxpro2中获取值的问题
- 下了个petshop4,想研究,但不会弄,怎么办
有木有办法解决?