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获取隐藏控件的值即可。
隐藏的控件:
<input id="WebEditor1" type="hidden" name="WebEditor1">
iframe:
1<iframe id="editor" onblur="WebEditor1_CopyEditContent();" style="WIDTH: 98.19%; HEIGHT: 344px"
2                                        name="myEditor" src="../OperateWord/editor.htm" width="98%" height="300"></iframe>
<script language="javascript">
        
        function WebEditor1_CopyEditContent()
        
{
                
//document.getElementById('WebEditor1').value = editor.document.body.innerHTML;
                
//document.getElementById('WebEditor1').value = document.frames("editor").frames("Composition").document.body.innerText;
        
        document.getElementById(
'WebEditor1').value = document.frames("editor").frames("Composition").document.body.innerHTML;
    
        
//}
        }


            
</script>

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

 

posted on 2007-07-09 15:48  大冰  阅读(1379)  评论(2编辑  收藏  举报