2011-11-12 10 views

答えて

3
var sPath = window.location.pathname; 
var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); 
if(sPage == "index.php"){ 
    do something 
} 
else if(sPage == "contact.php"){ 
    do something else 
} 
2

あなたはwindow.location.pathnameで見ることができる、この質問ページ用

"https://stackoverflow.com/questions/8102940/javascript-check-what-page-has-loaded" 

+0

本当に... – naveen

0

document.URLを確認して、読み込まれているページを確認できます。

関連する問題