如何抓取动态网页生成的数据?

zhhp23 2007-01-12 02:09:15
这个动态asp网页分框架,点击左边网页中的链接 如javascript:top.market.Openmarket(185)就会在右边框架中显示出数据

请教如何抓取这个数据?
QQ49363229 邮箱:ziseqing@126.com 非常感谢!!
...全文
889 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhhp23 2007-01-14
  • 打赏
  • 举报
回复
上面搞错了,应该是numsSource[i]为我需要获的数据。
zhhp23 2007-01-14
  • 打赏
  • 举报
回复
function Displaynums(numsSource, VolumeSource) {
var nums = document.getElementsByName('nums');
var Volume = document.getElementsByName('Volume');
if (numsSource.length == nums.length) {
for (i=0;i<numsSource.length;i++) {

if (numsSource[i] == '0') {
nums[i].innerHTML = ' '; //!!!这里得nums[i]就是我要获得的数据
Volume[i].innerHTML = ' '; }
else {
/*
// Change market colors
if (nums[i].innerHTML != '' && Volume[i].innerHTML != '' && (nums[i].innerHTML != numsSource[i] || Volume[i].innerHTML != VolumeSource[i])) {
nums[i].style.color='#FFFFFF';
Volume[i].style.color='#FFFFFF';
}
*/
nums[i].innerHTML = numsSource[i];
Volume[i].innerHTML = VolumeSource[i];
}
}
}
else {
window.location.reload();
}
}

这段代码我读出来了,我要得到得就是nums[i]这些数据 请问如何取的这些数据,小弟非常感谢~!
蒋晟 2007-01-14
  • 打赏
  • 举报
回复
read the javascript code and rewrite the function in C#.
蒋晟 2007-01-14
  • 打赏
  • 举报
回复
call the same DOM method
HtmlWindow PopupOptionWindow()
{

IHTMLAnchorElement ae = extendedWebBrowser1.GetLinkByHref("popupEligiNewRT");
if (ae != null)
{
Debug.WriteLine(ae.href);
//javascript:popupEligiNewRT('DIANA%20JOHN%20W',%20'SUB','form0')

//function popupEligiNewRT(name,opt,form){
// var str = "eligipopup.jsp?&name="+name+"&opt="+opt+"&form="+form;
// window.open(str, 'popupeligiwin', 'width=600,height=375,left=250,top=100,menubar=yes,status=yes,toolbar=no');
//}
string href = ae.href;
href = href.Substring(
href.IndexOf("("));
String delim = "()";
href = href.Trim(delim.ToCharArray());
string[] parameters = href.Split(",".ToCharArray());
delim = "'";
string name = parameters[0].Trim(delim.ToCharArray());
string opt = parameters[1].Trim(delim.ToCharArray());
string form = parameters[2].Trim(delim.ToCharArray());
string PopupURL = string.Format("https://www.example.com/eligipopup.jsp?&name={0}&opt={1}&form={2}", name, opt, form);
return extendedWebBrowser1.Document.Window.Open(PopupURL, "autopopupeligiwin", "width=600,height=375,left=250,top=100,menubar=yes,status=yes,toolbar=no", false);
}
return null;
}
zhhp23 2007-01-14
  • 打赏
  • 举报
回复
jiangcheng 高手请帮一下啊,怎么在客户端调用服务器端的java 函数,实在想不出办法了
zhhp23 2007-01-13
  • 打赏
  • 举报
回复
我也用这个的,但对于这个网站好像单独用httpwebrequest 取不到数据
Red_angelX 2007-01-13
  • 打赏
  • 举报
回复
我一直用HttpWebRequest
jxf654 2007-01-13
  • 打赏
  • 举报
回复
up
zhhp23 2007-01-13
  • 打赏
  • 举报
回复
点击这个javascript:top.market.Openmarket(185) 就会转到链接http://……/…….asp?185,然后怎么抓取这个数据保存呢?还有180,165数字不固定,每天更新,如何才能每天能自动分析这个数字,然后抓取这些页面上的数据保存呢?
蒋晟 2007-01-12
  • 打赏
  • 举报
回复
using mshtml;

/// <summary>
/// Returns a reference to the frame window with an given index in the top level document of the Webbrowser control
/// </summary>
/// <param name="frameIndex">zero-based index that specifies the index of the frame window</param>
[CLSCompliant(false)]
public IHTMLWindow2 GetFrameByIndex(int frameIndex)
{
IHTMLDocument2 htmlDocument = (IHTMLDocument2)this.Document.DomDocument;
return GetFrameByIndex(frameIndex, htmlDocument);
}
/// <summary>
/// Returns a reference to the frame window with an given index in an HTML document
/// </summary>
/// <param name="frameIndex">zero-based index that specifies the index of the frame window</param>
/// <param name="htmlDocument">the HTML document to search in</param>
[CLSCompliant(false), ComVisible(false)]
static public IHTMLWindow2 GetFrameByIndex(int frameIndex, IHTMLDocument2 htmlDocument)
{
if (htmlDocument == null)
return null;
object oIndex = frameIndex;
object oFrame=htmlDocument.frames.item(ref oIndex);
if (oFrame== null) return null;
return (IHTMLWindow2)oFrame;
}
jsyhello 2007-01-12
  • 打赏
  • 举报
回复
javascript:top.market.document.InnerHTML

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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