The final effect is as follows:
Step. inc. php:
Copy codeThe Code is as follows:
/**
* Step. inc. php installation steps effect class *
* Extract the main code from the installation results of the Comsenz data table for your learning.
* @ Author tianxin
* @ Version 1.0.0 *
*/
Class StepClass {
Function show_header (){
Define ('show _ head', TRUE );
$ Step = 1;
$ Version = 'beta1. 0 ';
$ Release = '000000 ';
$ Install_lang = 'simplified Chinese UTF8 version ';
$ Title = 'comsenz-like installation ';
$ Charset = 'uft-8 ';
Echo <EOT
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = $ charset"/>
<Title> $ title </title>
<Link rel = "stylesheet" href = "style.css" type = "text/css" media = "all"/>
<Script type = "text/javascript">
Function $ (id ){
Return document. getElementById (id );
}
Function showmessage (message ){
$ ('Notice '). value + = message + "\ r \ n ";
}
</Script>
<Meta content = "Comsenz Inc." name = "Copyright"/>
</Head>
<Div class = "container">
<Div class = "header">
<H1> $ title
<Span> $ version $ install_lang $ release </span>
EOT;
$ Step> 0 & $ this-> show_step ($ step );
}
Function show_step ($ step ){
$ Laststep = 4;
$ Title = 'comsenz-like installation ';
$ Comment = 'ongoing operation ';
$ Stepclass = array ();
For ($ I = 1; $ I <= $ laststep; $ I ++ ){
$ Stepclass [$ I] = $ I = $ step? 'Current': ($ I <$ step? '': 'Unactivated ');
}
$ Stepclass [$ laststep]. = 'last ';
Echo <EOT
<Div class = "setup step {$ step}">
<H2> $ title
<P> $ comment </p>
</Div>
<Div class = "stepstat">
<Ul>
<Li class = "$ stepclass [1]"> 1 </li>
<Li class = "$ stepclass [2]"> 2 </li>
<Li class = "$ stepclass [3]"> 3 </li>
<Li class = "$ stepclass [4]"> 4 </li>
</Ul>
<Div class = "stepstatbg stepstat1"> </div>
</Div>
</Div>
<Div class = "main">
EOT;
}
Function show_install (){
?>
<Script type = "text/javascript">
Function showmessage (message ){
Document. getElementById ('notic'). value + = message + "\ r \ n ";
}
Function initinput (){
Window. location = 'HTTP: // www.jb51.net ';
}
</Script>
<Div class = "main">
<Div class = "btnbox"> <textarea name = "notice" style = "width: 80%; "readonly =" readonly "id =" notice "> </textarea> </div>
<Div class = "btnbox marginbot">
<Input type = "button" name = "submit" value = "executing ...... "Disabled style =" height: 25 "id =" laststep "onclick =" initinput () ">
</Div>
<? Php
}
Function runquery (){
For ($ I = 1; $ I <= 15; $ I ++)
{
$ This-> showjsmessage ('Operation executed '.'. $ I. '...'. 'success ');
// Simulate the delay of each execution of an action
Sleep (1 );
}
}
Function showjsmessage ($ message ){
Echo '<script type = "text/javascript"> showmessage (\''. addslashes ($ message ). '\'); </script> '. "\ r \ n ";
Flush ();
Ob_flush ();
}
Function show_footer ($ quit = true ){
Echo <EOT
<Div class = "footer">©2001-2010 <a href = "http://www.jb51.net/"> sweetheart </a> Yao said the kill is very large. </div>
</Div>
</Div>
</Body>
</Html>
EOT;
$ Quit & exit ();
}
}
Call method:
Copy codeThe Code is as follows:
Header ('content-Type: text/html; charset = UTF-8 ');
Include ('step. inc. php ');
$ Step = new StepClass ();
// Display the page header
$ Step-> show_header ();
// Display the operation progress
$ Step-> show_install ();
// Operation
$ Step-> runquery ();
Echo '<script type = "text/javascript"> document. getElementById ("laststep "). disabled = false; document. getElementById ("laststep "). value = \ 'after all operations are performed, go to the next step \ '; </script> '. "\ r \ n ";
// Display the end of the page
$ Step-> show_footer ();
Complete demo: stepdemo.rar