页面(p1)具有指向另一页面的链接(p2)。我想从P1访问P2中的链接

时间:2018-06-09 15:53:55

标签: javascript

</head>
<body>
    <h1>Welcome to My Homepage</h1>
    <div id="details_readonly">
        To see Carnaval history:  <a
        href="http://carnaval.amazon.com/v1/viewHistory.do?type=monitor&name=PyOP.EU.MPQS.Prod.OneBox.RequestError">http://carnaval.amazon.com/v1/viewHistory.do?type=monitor&amp;name=PyOP.EU.MPQS...</a>

        To see Carnaval snapshot: <a
        href="http://carnaval.amazon.com/v1/viewSnapshot.do?timestamp=2018-05-17+22%3A40%3A34.475&amp;name=PyOP.EU.MPQS.Prod.OneBox.RequestError">http://carnaval.amazon.com/v1/viewSnapshot.do?timestamp=2018-05-17+22%3A40%...</a>
    </div>
</body>
</html>

我可以使用

访问此页面的href
var oLink = document.getElementById('details_readonly').getElementsByTagName("a");
var i, len = oLink.length;

for( i = 0; i < len; i++ ) {
    var li= oLink[i].getAttribute('href');              
    if(oLink[i].innerHTML.indexOf("viewSnapshot.do") != -1 ) {
        //...get document of the link
   }
}

但是,现在我想访问在链接的“//...get文档”中标识的链接的文档(以及随后的hrefs)?

是否可以使用javascript,如果是的话?

0 个答案:

没有答案