当前位置: 代码迷 >> ASP.NET >> 通过 Response.Write 能否在一个新的页面输出?解决方法
  详细解决方案

通过 Response.Write 能否在一个新的页面输出?解决方法

热度:6222   发布时间:2013-02-25 00:00:00.0
通过 Response.Write 能否在一个新的页面输出?
我在后台中编辑一个HTML的页面,想通过 Response.Write 方式在新的窗口中输出这页面,这样是否可行,还有其他方法吗?

------解决方案--------------------------------------------------------
可以输出javascript代码

参考windows.open
------解决方案--------------------------------------------------------
Response.Write("<script>window.open()</script>")
------解决方案--------------------------------------------------------
js
------解决方案--------------------------------------------------------
可行,没问题.你具体说说你的要求
------解决方案--------------------------------------------------------
Response.Write(" <script >window.open() </script >")
------解决方案--------------------------------------------------------
你应该将html字串写成文件,然后redirect(这个文件的url)
------解决方案--------------------------------------------------------
可以,但输出前,必须清空页面的一些信息,设置输出类型等等.



------解决方案--------------------------------------------------------
//简单啦,通过js实现:
string html = "<html > <head > <title > </title > </head > <body >.... </body > </html >";
Response.Write("<script>win=window.open('');win.document.write('"+html+"');win.document.close();</script>");


//里边这两句是关键:win=window.open('');win.document.write('"+html+"');win.document.close();
------解决方案--------------------------------------------------------
方法1:
Form.Attribute.Add("target","_black");

方法2:
在页面的form 属性上加上target="_black"


------解决方案--------------------------------------------------------
http://hi.baidu.com/rocy520/blog/item/a7bd0e3832a3d827b9998f28
------解决方案--------------------------------------------------------
人家是要在新网页中输出

string html = " <html > <head > <title > </title > </head > <body >.... </body > </html >"; 

这字符串呀....
------解决方案--------------------------------------------------------
输出是可以让浏览器执行html代码字符和js字符。想怎么写就怎么写了。
  相关解决方案