我是个网络爬虫新手。我正在尝试用java抓取网页,我遇到了一个问题。我需要获取一个'HTML标签‘中的链接,它的href是一个javascript函数。我不知道如何在javascript函数中获取链接。下面是html源代码和javascript源代码。
HTML
<a href='javascript:ShowPostGridUnique(205316,0);'>link</a>
JSShowPostGridUnique
function ShowPostGridUnique(parentpostid, pageShow) {
//alert(parentpostid);
var divid;
divid = 'divPostContent' + parentpostid;
if (document.getElementById(divid).className == 'divGridShow') {
document.getElementById(divid).className = 'divGridHide';
document.getElementById(divid).innerHTML = '';
}
else {
document.getElementById(divid).className = 'divGridShow';
// call server side method
PageMethods.divParentInnerHtml( parentpostid, pageShow, CallSuccessShowPost, CallFailedAlert, parentpostid);
try {
divid = 'TDtitle' + parentpostid;
document.getElementById(divid).className = 'TDtitle';
divid = 'TDPage' + parentpostid;
document.getElementById(divid).className = 'TDtitle';
}
catch (err) {
//Handle errors here
}
}
}
如何获取href的链接?谢谢。
发布于 2015-08-11 16:31:44
https://github.com/SeleniumHQ/selenium的http://phantomjs.org/
https://stackoverflow.com/questions/31936710
复制相似问题