//菜单功能模块;
function go() 
{//打开指定的网页,进行搜索资源;
urlList.options.length=0;
document.all.Content.src =address.value;
}
function clearList()
{//清空列表;
urlList.options.length=0;
downList.options.length=0;
tempList.options.length=0;
}
 
function modelChange()
{//打开可编辑模式。
if(model){
Content.document.designMode="On";
model=false;
}else{
Content.document.designMode="Off";
model=true;

}
function downImg(){//下载图片任务开始,直到downlist数据下完;
/*for(i=0;i<downList.length;i++){
DownURL(downList.options[0].value);
}*/
while(downList.length!=0){
DownURL(downList.options[0].value);
}
}
  
 function DownURL(strRemoteURL)
 {
  try
 {  
  var d ,s="";
  d = new Date();
  s+=d.getYear();
  s+=d.getDate();
  s+=d.getMonth();
  s+=d.getHours(); 
  s+=d.getMinutes() ;
  s+=d.getSeconds() ;
  s+=d.getMilliseconds();
  temp=strRemoteURL.split(".")//生成下载后的文件名;
  filename=s+"."+temp[temp.length-1] ;
  var xmlHTTP=new ActiveXObject("Microsoft.XMLHTTP");
  xmlHTTP.open("Get",strRemoteURL,false);
  xmlHTTP.send();   
  exeStatus=xmlHTTP.status=="200"?strRemoteURL+":OK":strRemoteURL+":FALSE";   
  if(xmlHTTP.status!="200") throw exeStatus;
  var adodbStream=new ActiveXObject("ADODB.Stream");
  adodbStream.Type=1;//1=adTypeBinary
  adodbStream.Open();
  adodbStream.write(xmlHTTP.responseBody);   
  adodbStream.SaveToFile(downimg+filename,2);  
  adodbStream.Close();
  adodbStream=null;  
  xmlHTTP=null;
  //writeXML(strRemoteURL);
  downSuccess+=strRemoteURL+"OK<br>^";
  //alert(exeStatus);
  setStatus(exeStatus);
  downList.remove(0);
 }
 catch(e)
 {
 // window.confirm(e);
 //出错时也清除对像;
   downList.remove(0);  
   downFailed+=strRemoteURL+"FALSE<br>^";
 }
 //window.confirm("下载完成.");
 setStatus(exeStatus);
}  function batchDown(){
 
 oPopup.show(200, 200, 180, 50, document.body);
 oPopup.document.write("<scr"+"ipt language='JavaScript'>function add(){parent.List(address.value,'downList')}</scr"+"ipt><body leftmargin=0 topmargin=0 scroll=no style='border:1 solid black'><input type=text id=address value='http://localhost:81/office/kfbbbs/pic/blue/xzb.gif'><input type=button onClick='add()' value=abc>");
 
 }
 
 function writeXML(url) { //预留模块,写入xml为历史记录;
 var aa,text,xmlroot; 
 xmlDoc = new ActiveXObject('Microsoft.XMLDOM')
 //xmlDoc.load("url.xml");
 var root = xmlDoc.documentElement; 
 var id = root.childNodes(0);
 alert(id);
 xmlDoc.async = false;
 aa = xmlDoc.createElement("url");
 text = xmlDoc.createTextNode(url);
 aa.setAttribute("id",id);
 aa.appendChild(text); 
 xmlDoc.documentElement.appendChild(aa);
 xmlDoc.save("url.xml");
 }
function setStatus(status){//显示状态;
  document.all.Status.innerText=status;
}
function listenPopup(){
for(var i=0;i<100;i++){
//<iframe src=down.html width=100% width=100%>asdf</ifrmae>
oPopupBody.innerHTML+="<font color=red>"+i+"</font>";
}
}//setErrorHandle()//启动检测出错;//-->
</SCRIPT>

解决方案 »

  1.   

    <SCRIPT LANGUAGE="VBScript">
    Sub batchdown1
       '* resize parent window
      ' self.ResizeTo 0,0
      ' self.MoveTo 300,300
       
       '* create dialog window   Set objDialogWindow = window.Open("about:blank","ProgressWindow","height=15,width=250,left=300,top=300,status=no,titlebar=no,toolbar=no,menubar=no,location=no,scrollbars=no") 
       objDialogWindow.Focus()
       objDialogWindow.ResizeTo 250,15
       objDialogWindow.document.body.style.fontFamily = "Helvetica"
       objDialogWindow.document.body.style.fontSize = "11pt"
       
       objDialogWindow.document.writeln "<script>"
       objDialogWindow.document.writeln "function go(){ opener.List(address.value,'downList');}<scr"
       objDialogWindow.document.writeln "ipt><input name=address><button onclick=go()>go</button>"
       objDialogWindow.document.title = "Please wait."
       objDialogWindow.document.body.style.backgroundColor = "buttonface"
       objDialogWindow.document.body.style.borderStyle = "none"
       objDialogWindow.document.body.style.marginTop = 15
       end sub
       </script> <body>
     <table border="0"  width="100%" cellspacing="0"  cellpadding="0" bgcolor="#0099ff"  onmouseup="drag_up()" onmousemove="drag_move()" onmousedown="drag_down()">
      <tr>
      <td>
      BamBu_Wpd V2.0
      </td>
     <td align="right">
     <label class="Alabel" title="最小化" onclick="MiniWin()">_</label><label class="Alabel" title="最大化" onclick="MaxWin()">□</label><label class="Alabel" title="关闭" onclick="MiniWin()">×</label>
     </td>
      </tr>
    </table>
    <table width="100%" height="100%" border="0" cellspacing="0">
     
      <tr>
        <td width="77%" height="23"><span id=AddText>地址:</span>
    <input type=text value="" id=address style="width: expression(document.body.clientWidth - AddText.offsetWidth - AddGo.offsetWidth - 200)" size="20">
    <button  id=AddGo onclick="go()">Go</button></td>
        <td width="23%" colspan="2"><span id=getUrlNum>
    <SELECT onchange="getUrlMaxNum=this.options[this.selectedIndex].value;" disabled>
    <OPTION value=1 >1</OPTION>
    <OPTION value=2 selected>2</OPTION>
    <OPTION value=3>3</OPTION>
    <OPTION value=4>4</OPTION>
    </SELECT> 
    <button onclick="batchDown()">批量下载</button>
    <button onclick="exetask()">搜索</button>
    <button onclick="downImg()">下载</button>
    </span> 
     </td>
      </tr>
      <tr style="height: expression(document.body.clientHeight-100)">
        <td  colspan="3" valign=top><iframe  id="Content" width="100%" style="height: expression(document.body.clientHeight-100)"></iframe></td>
      </tr>
      <tr>
        <td height=5 valign=top colspan="3"><INPUT TYPE="checkbox" NAME="mode" id="mode" onclick="modelChange()">切换模式<SELECT name=downList ID=downList SIZE=1> 
    </select>
    <SELECT name=urlList ID=urlList SIZE=1> 
    </SELECT>
    <SELECT name=tempurlList ID=tempurlList SIZE=1> 
    </SELECT>
    <button onclick="clearList()">清空列表</button></td>
      </tr>
      <tr>
        <td colspan="3">
    <table border="0" cellpadding="0" cellspacing="2" disabled  width="100%"  height="25"  style="background:buttonface;border-right:1px solid buttonshadow;border-left:1px solid buttonhighlight;border-bottom:1px solid buttonshadow;border-top:1px solid buttonhighlight">
          <tr>
            <td style="BACKGROUND-COLOR:buttonshadow" valign="bottom">
                <div id="Status" style="font-size:11px"></div></td>
          </tr>       
        </table>
    </td>
      </tr>
    </table></body><script>
      
    Content.onerror = return true; //不检测任何错误;
    </script>
      

  2.   

    保存以上代码为hta 文件,输入网址,搜索图片,搜索完毕后提示搜索完成,即可点击下载,默认下载文件夹为img/。程序运行中可能会出现假死现像。把这个程序提供出来,请大家评一下,提些建义,优化一下,使这个软件更实用,更完美
      

  3.   

    保存为hta时被Symantec AntiVirus Killed. 提示:downloader.Trojan
      

  4.   

    晕。我测试的时候,也是这样。Symantec AntiVirus里认为这段代码里有病毒的特征,我没有去测试,可能是里边有写文件的操作吧。但是本人绝对保证,本程序为绿色软件,一点影响系统的操作都没有。不含任何病毒。特此声明