开发者社区> 问答> 正文

怎么实现进度查询?

screenshot
各位大神,这种进度查询的样子是怎么实现的啊?
是用javascript吗?
各位大神有例子可供小弟参考下吗~太感谢了

展开
收起
小旋风柴进 2016-03-19 08:58:03 1924 0
1 条回答
写回答
取消 提交回答
  •  <html>
    <head>
        <title>step by step</title> 
    </head>
    <body>
        <div id="navigatorPic" style="position:fixed;top:100px;left:100px;width:730px;height:100px;background-image:url(step1.png)">
        </div>
    
        <div style="color:blue;font-family:Microsoft YaHei;font-size:20px;position:relative;top:400px;left:300px;">
            click next step, submit by Ajax.
            <div id="step1" style="display:block">
                current step is step1.
            </div>
            <div id="step2" style="display:none">
                current step is step2.
            </div>
            <div id="step3" style="display:none">
                current step is step3.
            </div>
            <div id="step4" style="display:none">
                current step is step4.
            </div>
            <input type="button" value="last step" onclick="lastStep();"><input type="button" value="next step" onclick="nextStep();">
        </div>
    
        <script language="javascript" type="text/javascript">
            var stepIndex = 1;
            var stepNum = 4;
            function nextStep(){            
                if(stepIndex<stepNum){
                    stepIndex++;
                    document.getElementById("navigatorPic").style.background = "url(step"+stepIndex+".png)";
                    for(var i=1;i<=stepNum;i++){
                        document.getElementById("step"+i).style.display = 'none';
                    }
                    document.getElementById("step"+stepIndex).style.display = 'block';
                }
            }
    
            function lastStep(){            
                if(stepIndex>1){
                    stepIndex--;
                    document.getElementById("navigatorPic").style.background = "url(step"+stepIndex+".png)";
                    for(var i=1;i<=stepNum;i++){
                        document.getElementById("step"+i).style.display = 'none';
                    }
                    document.getElementById("step"+stepIndex).style.display = 'block';
                }
            }
        </script>
    </body>
    </html>
    
    2019-07-17 19:07:08
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
面向失败设计 立即下载
动态、高效,蚂蚁动态卡片的内核逻辑 立即下载
十分钟上线-使用函数计算构建支付宝小程序服务 立即下载