我在做一个网络采集程序,在分析一个网页时无法得到一个由javascript生产的链接地址,请各位大虾教教小弟!感激不尽!
网页地址:http://jlzx.k12.com.cn/derup/page/detail.php/K12CENTER000002-0000000000506993?0ec7fcb5c260612c797510fdea3b4cd7
在IE里可以看到"下载点:本地下载"这样的文字,其中"本地下载"是一个链接,但点"属性"只能看到指向自己的地址"http://jlzx.k12.com.cn/derup/page/detail.php/K12CENTER000002-0000000000506993?0ec7fcb5c260612c797510fdea3b4cd7#"
在分析网页源文件时发现生成"本地下载"这个链接地址的是由一个javascript来完成的,代码如下
<a href="#" onclick="urlhref(\''+t.url+'\');">';

if(gDerupId == t.derupId  || "" == t.derupId){
download_url += "本地下载</a></p>";
}else{
download_url += t.corpName + "</a></p>";
}
}
而分析urlhref 这个函数时,却怎么也无法找到它是怎么生成t.url这个东东的,也就无法得知具体的下载页地址,但如果用鼠标在IE中点击这个"本地下载"就可以看到一个弹窗,在弹窗中可以看到真正的下载地址.所以想请大家看看怎么才能得到这个链接地址?

解决方案 »

  1.   

    <input   id= "in_name "   name= "in_name "   maxlength= "11 "   class= "text "   le= "width:149px; "/> 
    <input   id= "in_password "   name= "in_password "   type= "password "   class= "text "   style= "width:126px; "/> 
    <input   type= "image "   src= "images/mfs2/mfw/l01.gif "   id= "Login "   style= "margin-left:190px; "/> WebBrowser1.Document.All( "in_name ").Value   =   "123456 "           '帐号 
    WebBrowser1.Document.All( "in_password ").Value   =   "xxxxx "       '密码   
    WebBrowser1.Document.All( "Login ").Click         '点击提交按钮
      

  2.   

    TO 小猪妹马甲之八卦兔子:
    我对java不熟悉,用baidu查了一些关于getattribute的资料,好象是用于服务器端的函数,我是用VB写一个类似于网络爬虫的程序,不知该怎么使用这个函数?
    TO 悬崖边的舞者:
    你可能没明白我的意思,首先我无法得到其ID,另外用.click方法我也试过,无法得到弹出窗口的代码的。
      

  3.   

    补充一下:如果用fontpage打开,可以看到是这样一段代码在提供下载地址:“            <script type="text/javascript">document.write(download_url);</script>
    ”。
      

  4.   

    set objs=WebBrowser1.Document.getElementsByTagName("a")
    for i=0 to objs.length-1
    msgbox objs[i].getAttribute("onclick")
    next好久没写vb了,好亲切的说...
      

  5.   

    网络爬虫我经常写webbrowser这种是我最拿手的,不过,这个有很多缺陷,太慢了,而且分析的时候不灵活好处是超级简单如果你对dhtml很熟悉的话,将会相当的简单