2012-11-15 40 views

回答

0
$(document).ready(function() { 
    var pathArray = window.location.pathname.split('/'); 
    //Then access the different parts by the parts of the array, like 
    var secondLevelLocation = pathArray[0]; 

}); 
0

嘗試後,要什麼有什麼的第一個字:

$(document).ready(function() { 
    var currentUrl= window.location.pathname.split('/')[1]; 
    alert (currentUrl); 
}); 
+0

爲什麼downvote? – DarkAjax

相關問題