如题,一个页面(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>");
}
}
}
解决方案 »
- asp.net2.0网站,web层引用dal,bll,等其它层,总是提示找不到类型或命名空间名称“School_DAL”(是否缺少 using 指令或程序集引用
- DataCacheFactory释放的问题
- 如何限制输入框只能输入数字
- 用ajax写的联动dropdownlist,提交数据库的时候怎样在后台取里边的数据???
- 简单问题:asp.net如何取地址栏的地址
- 要开发一个类似SessionStateModule 的模块,如何设计?
- 用js控制,当checkbox勾上时,treeview的勾也勾上,checkbox的勾取消,treeview的勾也取消,如何写?
- 如何给gridview中字段加链接,实现不同字段跳转不同界面功能?(请高手们帮忙啊!小弟不胜感激)
- 如何遍历XmlDocument中的所有节点,并且对符合某条件的节点进行元素值的修改?
- iis 虚拟目录 出现 0x80070006 问题
- ajaxpro2中获取值的问题
- 下了个petshop4,想研究,但不会弄,怎么办
有木有办法解决?