嗨請檢查https://jsfiddle.net/9b0wL9tn/
jQuery的
$(document).ready(function(){
$('a').each(function(){
console.log($(this).attr('href'));
});
});
注意:在Chrome中打開網站>>右鍵點擊>>檢查>>轉到控制檯選項卡並粘貼以下內容並按下回車鍵
運行該代碼首先在控制檯上:
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type.
jQuery.noConflict();
然後運行這個
$('a').each(function(){
console.log($(this).attr('href'));
});
這會列出該網頁上的所有鏈接只是把它從控制檯
更新複製
家繼上一個步驟後更新腳本...在控制檯中運行以下腳本:
var arr=new Array();
jQuery('a').each(function(i){
arr[i]=jQuery(this).attr('title')+"";
});
jQuery.each(arr,function(i){
if(arr[i].indexOf('http')>-1)
console.log(arr[i].substr(0, arr[i].indexOf('-')));
});
這裏是截圖:http://www.imageno.com/lj7tuyr9pt2opic.html
來源
2016-04-21 06:10:46
RRR
當我粘貼後的代碼到控制檯,並按下回車,我(...)(匿名函數)@ VM214:2InjectedScript._evaluateOn @ VM90:878InjectedScript._evaluateAndWrap @ VM90:811InjectedScript.evaluate @@ VM904: VM90:667「 – prakharjain
也許這是因爲該網站使用jQuery – RRR
或將此擴展程序添加到您的Chrome https://chrome.google.com/webstore/detail/jquerify/gbmifchmngifmadobkcpijhhldeeel kc?hl = en – RRR