The test file does not include all Code Write them all, just list the relevant code
1. Prototype. js
This does not need to be downloaded from the Internet.
Ii. Test. aspx
VaR progressbar;
VaR URL;
VaR loadtext;
Function userlogin (loadtext, URL ){
// Start data submission
Progressbar = new progressbar ();
Progressbar. setstatus (loadtext );
If (URL! = NULL)
{Location. href = URL ;}
}
Then add a button.
Iii. Test. aspx. CS
Register an event on the button.
Private void page_load (Object sender, system. eventargs E)
{
This. button1.attributes. add ("onclick", "javascript: userlogin (' <br> <a class = baizi> submitting data... </a> ', null )");
}
Private void button#click (Object sender, system. eventargs E)
{
Pub. calljavascript (this, "userlogin", " <br> <a class = baizi> loading page, please wait .. <A> "," exchange. aspx ");
}
Iv. Pub. CS
This class writes a public method to call the client from the server side.
Public static void calljavascript (page, string funname, string STR, string URL)
{
Stringbuilder strscript = new stringbuilder ();
Strscript. append ("<script language = JavaScript> ");
Strscript. append (funname + "('" + STR + "', '" + URL + "');");
Strscript. append ("</SCRIPT> ");
If (! Page. isstartupscriptregistered ("call" + funname ))
{
Page. registerstartupscript ("call" + funname, strscript. tostring ());
}
}