示例一:
process bar
0%
再来分享一个结合.net的
建立一个web工程,添加新项->html页面,命名为progressbar.htm,内容如下:
无标题页
后台代码,default.aspx.cs:
using system;using system.data;using system.configuration;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;using system.threading;using system.io; public partial class _default : system.web.ui.page { private void beginprogress() { //根据progressbar.htm显示进度条界面 string templatefilename = path.combine(server.mappath(.), progressbar.htm); streamreader reader = new streamreader(@templatefilename,system.text.encoding.getencoding(gb2312)); string html = reader.readtoend(); reader.close(); response.write(html); response.flush(); } private void setprogress(int percent) { string jsblock = ; response.write(jsblock); response.flush(); } private void finishprogress() { string jsblock = ; response.write(jsblock); response.flush(); } private void page_load(object sender, system.eventargs e) { beginprogress(); for (int i = 1; i