200分求 WebBrowser.ExecWB指定打印(另存为)的成功代码 100分后补

lixinbill 2010-03-05 03:39:13
RT
...全文
65 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
lixinbill 2010-03-05
  • 打赏
  • 举报
回复
2楼能给加个注释或者怎么调用么?
shan1119 2010-03-05
  • 打赏
  • 举报
回复
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();
lixinbill 2010-03-05
  • 打赏
  • 举报
回复
真没人用过啊?悲哀****************

87,921

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧