用Request方法从页面得到Html内容时的处理 及 iframe中控件内容的获取

1.用request方法从页面取得数据若包含html格式数据,则会提示出错,解决方法为:在web.config中<system.web>中增加<pages validateRequest="false"></pages>即可

2. 若页面使用了iframe,若要获得iframe中的控件内容,如下:
editor 为一frame的ID,Composition为editor中包含的另一frame的ID,
document.frames("editor").frames("Composition").document.body.innerHTML;
一般使用在新闻或文字类的编辑功能中,此时,在页面增加一隐藏的input控件,然后在iframe中增加事件,最后在后台通过request获取隐藏控件的值即可。
隐藏的控件:
None.gif < input id = " WebEditor1 "  type = " hidden "  name = " WebEditor1 " >
iframe:
1 None.gif < iframe id = " editor "  onblur = " WebEditor1_CopyEditContent(); "  style = " WIDTH: 98.19%; HEIGHT: 344px "
2 None.gif                                        name = " myEditor "  src = " ../OperateWord/editor.htm "  width = " 98% "  height = " 300 " ></ iframe >
None.gif < script language = " javascript " >
None.gif        
None.gif        function WebEditor1_CopyEditContent()
ExpandedBlockStart.gif        
{
InBlock.gif                
//document.getElementById('WebEditor1').value = editor.document.body.innerHTML;
InBlock.gif                
//document.getElementById('WebEditor1').value = document.frames("editor").frames("Composition").document.body.innerText;
InBlock.gif
        
InBlock.gif        document.getElementById(
'WebEditor1').value = document.frames("editor").frames("Composition").document.body.innerHTML;
InBlock.gif    
InBlock.gif        
//}
ExpandedBlockEnd.gif
        }

None.gif
None.gif            
</ script >

后台取值:Request["WebEditor1"].ToString()

 

转载于:https://www.cnblogs.com/hanbing768/archive/2007/07/09/811321.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值