找回密码
 加入
搜索
查看: 2763|回复: 6

[IE类操作] 我该如何获取这个拉条的的进度呢?还有如何判断其结果啊?

  [复制链接]
发表于 2012-10-22 09:47:53 | 显示全部楼层 |阅读模式

RT。我该如何从HTML中获取这个拉条的信息,然后在编写一个脚本统计反应这个拉条信息啊,同时,拉条完成后会弹出结果框,这个我又该如何编写结果保存啊?
不知道如何下手。。。。。。
请大神帮下忙。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2012-10-22 14:37:55 | 显示全部楼层
无网站 无代码 无全截图的三无人员再牛B的大神也帮不上忙啊!!!
目测这个小截图,给你的答案是获取那个10%的字符...
获取这个网页的源码,然后正则比对....
还有,好像网页没有进度条,都是CSS样式画出来的!!
 楼主| 发表于 2012-10-22 15:02:00 | 显示全部楼层
本帖最后由 fanxiang_1984 于 2012-10-22 15:25 编辑

回复 2# 小凯


    就是类似进入网页版三国杀时,他需要下载一些信息,我怎么能随时记录这个下载信息。
网页版三国杀网址:http://web.sanguosha.com/

下面是我的源码。
<html>
<head>
<META http-equiv="pragma" content="no-cache" />
<META http-equiv="Content-Language" content="zh-cn">       
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<LINK href="styleregister.css" type="text/css" rel="stylesheet">
<title>123</title>
<style type="text/css">
#information{font: 10pt "Arial"; color: #008080}
</style>
</head>

<body>
<TABLE cellSpacing=0 cellPadding=0 width=808 align=center border=0>
        <TR>
                <TD ><IMG height=137 src="../images/register_banner.gif" width=808></TD>
        </TR>
        <TR>
                <TD>
                        <TABLE cellSpacing=0 cellPadding=0 align=middle width=808 border=0>
                                <TR>
                                        <TD width=77 background="../images/bg.gif" rowSpan=3></TD>
                                        <TD align=center width=653 height=323 background="../images/register_content.gif">
                                                <TABLE cellSpacing=0 cellPadding=0 width=96% height=15% border=0>
                                                        <TR>
                                                                <TD align=right><A href="../cgi-bin/login.htm.cgi"><FONT size=2 color=#000000>返回登录</FONT></A></TD>
                                                        </TR>
                                                </TABLE>
                                                <TABLE cellSpacing=0 cellPadding=0 width=400 border=0 height=80% align = center>
                                                        <TR>
                                                                <TD colSpan=2 height=32 id="note"></TD>
                                                        </TR>
                                                        <TR align>
                                                                <TD colSpan=2 width=100% height=10 align=center>       
                                                                        <div  id="progress" align=left></div>
                                                                </TD>
                                                        </TR>
                                                        <TR>
                                                                <TD align=center colSpan=2 width=100% height=20 id="information">正在登陆,请稍后...</TD>
                                                        </TR>
                                                        <TR>
                                                                <TD align=center colSpan=2 width=100% height=20><font size=2>客服热线:100</font></TD>
                                                        </TR>
                                                        <TR>
                                                                <TD align=left colSpan=2 height=60></TD>
                                                        </TR>
                                                </TABLE>
                                        </TD>
                                        <TD width=78 background="../images/bg.gif" rowSpan=3></TD>
                                </TR>
                        </TABLE>
                </TD>
        </TR>
</TABLE>
<script type="text/javascript" language="javascript">
<!--
var start = '0';
var bar;
var res;
var count = 0;
var result_flag = 0;
var result_count = 0;
function CProgress(progressIdStr, width, height, pos)
{
    this.progressIdStr = progressIdStr;
    this.progressId = document.getElementById(this.progressIdStr);
    this.barIdStr = progressIdStr + "_bar";
    this.barId = null;
   
    this.pos = pos>=100?100:pos;
    this.step = 1;
        this.rate = 10;
        this.limit = 10;
        this.result = "正在登陆,请等待...";

    this.progressWidth = width;
    this.progressHeight = height;
   
    this.Create = Create;

    this.SetStep = SetStep;
    this.SetPos = SetPos;
        this.SetResult = SetResult;
        this.SetRate = SetRate;
        this.SetLimit = SetLimit;
    this.Inc = Inc;
    this.Desc = Desc;
}

function Create()
{
    if (document.all)
    {
        this.progressId.style.width = this.progressWidth+2;
    }
    else
    {
        this.progressId.style.width = this.progressWidth;
    }
    this.progressId.style.height = this.progressHeight;
    this.progressId.style.fontSize = this.progressHeight;
    this.progressId.style.border = "1px solid #000000";
    this.progressId.innerHTML = "<div id=\"" + this.barIdStr + "\" style=\"background-color:#aabbcc;height:100%;text-align:center\"></div>";
    this.barId = document.getElementById(this.barIdStr);
    this.SetPos(this.pos);
}

function SetStep(step)
{
    this.step = step;
}

function SetPos(pos)
{
    this.pos = (pos<=0)?0:pos;
    this.pos = (parseInt(this.pos) >parseInt(this.limit))?this.limit:this.pos;
    if(this.rate < 0)
            this.pos = 100;

                showResult();
}

function Inc()
{
        count++;               
        this.pos = parseInt(this.pos) + parseInt(this.step);
        this.SetPos(this.pos);
}

function Desc()
{
    this.pos -= this.step;
    this.SetPos(this.pos);
}

function SetLimit(limit){
        this.limit = limit<0?0:limit;
        this.limit = this.limit>100?100:this.limit;
}

function SetRate(rate){       
        this.rate = rate;

        if(parseInt(rate) > parseInt(this.pos)){                       
                this.SetLimit(parseInt(rate));
        }
}

function SetResult(result){
        this.result = result;
}

function showResult(){       
        if(count > 180) {
                progress.barId.style.width = "100%";
                document.getElementById("information").innerHTML="<a href=\"/register.html\">登陆超时!请检查后重试</a>";
        }else{
                progress.barId.style.width = progress.pos+"%";
                if(parseInt(progress.rate)!=100 || parseInt(progress.pos)==100)
                        document.getElementById("information").innerHTML = progress.result;
        }

        progress.barId.innerHTML=progress.barId.style.width;

        if(progress.barId.style.width == "100%"){
                window.clearInterval(bar);
                window.clearInterval(res);
                return;
        }
}

// create an XMLHttpClient in a cross-browser manner  
function initXMLHttpClient(){  
   var xmlhttp;  
   if (window.ActiveXObject)
   {
       xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
   }
   else
   {
       xmlhttp = new XMLHttpRequest();
   }
   return xmlhttp;
}

function send_request(){
   request.open('GET','register_res.html.cgi?num='+new Date().getTime(), true); // open asynchronus request  
   request.onreadystatechange = request_handler;          // set request handler  
   request.send(null);                                    // send request  
}

function request_handler(){
   if (request.readyState == 4){ // if state = 4 (the operation is completed)  
   
     if (request.status == 200 || request.status == 0){ // and the HTTP status is OK  
       // get progress from the XML node and set progress bar width and innerHTML  
       var array = request.responseText.split(";");
     if(array[0] == -2){
                     alert('登陆失败,请输入正确的ID密码');
                     window.location='../register.html';
     }
           if( array[2] >= 32 ){
                           if(array[0]<20){
                                   alert('登陆超时,请检查线路并输入正确的ID密码');
                                   window.location='../register.html';
                           }else{
                       alert('业务下发失败,请检查管理配置');
                       window.location='../index.html';
              }
                  
           }else if( array[2] < 5 ){
               count=0;
                }
           progress.SetRate(array[0]);          
           progress.SetResult(array[1]);
           result_flag = 1;
           //result_count += 1;
           //document.getElementById("note").innerHTML=array[0]+";"+array[1]+";"+array[2]+";"+count+";" + result_count;
     }  
     else{ // if request status is different then 200  
       progress.style.width = '100%';  
       progress.innerHTML='Error: ['+request.status+'] '+request.statusText;  
     }  
   }
}

function checkresult(){
         
        if(result_flag == 1){
                result_flag = 0;
                send_request();               
        }
}

var request  = initXMLHttpClient();

var progress = new CProgress("progress", 300, 15, 0);
progress.Create();
if(start == 0){
        send_request();
        bar = setInterval("progress.Inc();",400);
        res = setInterval("checkresult();",2000);
}else if(start == 2){
        document.getElementById("information").innerHTML="登陆次数已超过最大重试次数<br>请联系100";
}else{
        document.getElementById("information").innerHTML="程序内部错误";
}
//-->
</script>
</body>
</html>
发表于 2012-10-22 15:10:02 | 显示全部楼层
下载信息是通过FLASH下载的!!auto貌似还不可以读取FLASH信息....或许有别的方法可以读取是否下载完毕!!
 楼主| 发表于 2012-10-22 15:27:25 | 显示全部楼层
回复 4# 小凯


    我刚一直在查进度条方法。AU还是刚开始学习。无从下手啊。。。
 楼主| 发表于 2012-10-23 17:00:05 | 显示全部楼层
解决不了。。。学习的东西太多了。痛苦!
 楼主| 发表于 2012-10-25 08:42:11 | 显示全部楼层
决定放弃了,才开始学,就搞这个让我做。。。
杯具。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-15 10:35 , Processed in 0.080265 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表