Modify JavaScript Code to hide display asp:panel

Hi
I found this code on the web and was wondering if anyone can modify it so that i makes visible or hides a asp:panel and also works in Firefox.

This is what i need to show or hide

----------------------------------------

<asp:Panel ID="pnlUpoadingVideo" EnableViewState="false" runat="server">
     <img alt="" src="../App_Themes/ForumLayout/Images/progressbar_long_green.gif" /><br />
                      Uploading, Please wait.....
                     
    </asp:Panel>

-----------------------------------------

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>");

        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();

        }

    //Javascript function to clear progressbar

    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);

        }

Thanks
George
ImInNeedOfHelpAsked:
Who is Participating?
 
Michel PlungjanConnect With a Mentor IT ExpertCommented:
I added
function StopShowWait(){up_div.style.visibility='hidden';clearInterval(tId);pnlUpoadingVideo.style.visibility='visible'; }

to this:



<div id='updiv' style='Font-weight:bold;font-size:11pt;Left:320px;COLOR:black;font-family:verdana;Position:absolute;Top:140px;Text-Align:center;'></div>
&nbsp;<script>
var tId = ''; 
var pnlUpoadingVideo = document.getElementById('pnlUpoadingVideo');//please check the html for the real ID
var up_div=document.getElementById('updiv');up_div.innerText='';
var dts=0; var dtmax=10;
function ShowWait(){var output;output='Please wait while uploading!';dts++;if(dts>=dtmax)dts=1;
for(var x=0;x < dts; x++){output+='';}up_div.innerText=output;up_div.style.color='red';}
function StartShowWait(){up_div.style.visibility='visible';ShowWait();tId=window.setInterval('ShowWait()',100);}
function StopShowWait(){up_div.style.visibility='hidden';clearInterval(tId);}
StartShowWait();
</script>

Open in new window

0
 
Michel PlungjanIT ExpertCommented:
giving a


public static void ClearProgressBar() {
  StringBuilder sbc = new StringBuilder();
  sbc.Append("<script language='javascript'>");
  sbc.Append("StopShowWait();");
  sbc.Append("</script>");
  HttpContext.Current.Response.Write(sbc);
}

Open in new window

0
All Courses

From novice to tech pro — start learning today.