在asp.net页中执行Response.Write("");页面变形的问题
来源:互联网 发布:淘宝助手详情批量替换 编辑:程序博客网 时间:2024/04/29 02:42
原因:直接Response.write输出脚本代码到顶部,打乱了文档模型,所以造成了这样的结果。
解决方法:
方法一:把Response.Write()语句替换为这个
Page.RegisterStartupScript(GetType(),"",("<script>alert('弹出!');</script>");</script>");
这个方法用于在页响应中发出客户端脚本块。具体RegisterStartupScript详细使用方法查询MSDN。
方法二:在原程序的Response.Write()语句后再加一句
(Response.Write("<script>document.location=document.location;</script>");)
两种方法都可以解决问题,但是个人建议使用方法一,毕竟是微软官方推荐的方法。
- 在asp.net页中执行Response.Write("");页面变形的问题
- asp.net 执行Response.Write后页面变形问题
- asp.net 执行Response.Write后页面变形
- asp.net中使用response.write造成界面变形问题的解决办法
- response.write后页面变形的问题
- 关于ASP.NET中用Response.Write()方法响应导致页面字体变大的问题
- 关于ASP.NET中用Response.Write()方法响应导致页面字体变大的问题
- response.write 页面变形解决办法
- response.write 页面变形解决办法
- 解决response.write输出脚本后出现页面变形的问题
- 解决response.write输出脚本后出现页面变形的问题
- asp.net执行Response.Write()方法后导致页面字体变大|css失效
- asp.net中Response.Write用法小结
- asp.net中执行到Response.write("xx");这段语句时出现下面的情况,请问如何改正?
- asp中response.write('中文') 乱码问题
- .net中response.write会改变css布局的问题
- asp.net中Response.write与Response.Redirect同时使用
- ASP.NET response.write alert后 导致页面布局改变的解决方法
- Win7下IE 8内存保护可能导致ActiveX无法安装的问题及其解决方法
- hibernate annotation
- MTOM以及在WCF中的应用
- 如何访问嵌套母版页中的控件
- 读取数据库中的图片(ASP.NET)
- 在asp.net页中执行Response.Write("");页面变形的问题
- GCC汇编器研究
- 两个很好玩的网站
- Meshgrid命令详解
- .NET 4中并行编程的简单例子
- 如何在Windows Service或者Windows Forms输出Console.Write的信息
- Bloom Filter
- jQuery学习笔记
- 指针类型转换(非常棒非常全的一篇文章)