开发者

Graphic Upload process?

In my application i have a page where videos are uploaded. In this page i am doing video conversion, it will take time to video conversion, so i want to display the image or message while video conversion is under process, after that the display image should not display. can u help me i take some code form google search it is working fine in IE but not in fire fox.

public static void PrintProgressBar()

    {

       StringBuilder sb = new StringBuilder();

       sb.Append("<div id='updiv' style='Font-weight:bold;font-size:11pt;Left:320px;COLOR:black;font-family:verdana;Position:absolute;Top:140px;Text-Align:center;'>");

      sb.Append("&nbsp;<script> var up_div=document.getElementById('updiv');up_div.innerText='';</script>")开发者_JAVA百科;

       sb.Append("<script language=javascript>");

        sb.Append("var dts=0; var dtmax=10;");

       sb.Append("function ShowWait(){var output;output='Please wait while uploading!';dts++;if(dts>=dtmax)dts=1;");

      sb.Append("for(var x=0;x < dts; x++){output+='';}up_div.innerText=output;up_div.style.color='red';}");

       sb.Append("function StartShowWait(){up_div.style.visibility='visible';ShowWait();window.setInterval('ShowWait()',100);}");

       sb.Append("StartShowWait();</script>");

       HttpContext.Current.Response.Write(sb.ToString());

        HttpContext.Current.Response.Flush();

       btnSubmit.Enable = false;

}   



public static void ClearProgressBar()

    {



        StringBuilder sbc = new StringBuilder();

        sbc.Append("<script language='javascript'>");

        sbc.Append("alert('Upload process completed successfully!');");

        sbc.Append("up_div.style.visibility='hidden';");

        sbc.Append("history.go(-1)");

        sbc.Append("</script>");

        HttpContext.Current.Response.Write(sbc);

    }

This is code i am using


Calling Response.Write() will output the script at the wrong point in the HTML.

You should instead use the built in methods to add scripts to the page, and create the correct Html elements in code and add them to the relevant controls.

Method to add script to a webpage:

Page.RegisterClientScriptBlock(String scriptIdentifier, String script, 
       [optional Boolean addScriptTagsAroundScript]);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜