RT

解决方案 »

  1.   

    have a try(from internet)
    var d1, id, title, subtitle, contents;
    var str, start, end, tmp;
    var IE = WScript.CreateObject("InternetExplorer.Application");
    //IE.Visible = true;
    IE.Width = 680; IE.Height = 660;
    IE.Navigate("http://www.asahi.com/paper/front.html");
    while(IE.busy) ;
    while(IE.Document.readyState != "complete") ;str = IE.document.body.innerHTML;//get date
    start = str.indexOf("<I>") + 3;
    end = str.indexOf("</I>", 3);
    d = new Date(str.substring(start, end));
    d1 = d.getYear() + "/" + d.getMonth() + "/" + d.getDate();
    str = str.slice(end + 3);id = 1;
    while((start = str.indexOf("<H3>")) != -1) {
    end = str.indexOf("</H3>");
    title = str.substring(start + 5, end); //title
    tmp = end + 5;
    if((end = title.indexOf("<BR>")) != -1) { //sub title
    start = title.indexOf("-1>", end) + 3;
    subtitle = title.slice(start, -7);
    title = title.substring(0, end);
    }
    else
    subtitle = "";
    end = tmp;
    str = str.slice(end);

    //content
    end = str.indexOf("<HR>");
    contents = str.substring(0, end);
    contents = RemoveTags(contents); //remove tag
    str = str.slice(end + 4);

    WScript.Echo("|" + d1 + "|" + (id++) + "|" + title
    + "|" + subtitle + "|" + contents + "^");
    }function RemoveTags(str) {
    var pos;
    while(/<[^<]+>/.test(str)) {
    /<[^<]+>/.exec(str);
    str = str.substring(0, RegExp.index) + str.slice(RegExp.lastIndex);
    }
    return str;
    }IE.Quit();