document.URL 讀取URL | indexOf() | substring()
JavaScript document.URL 得出網頁現在的網址,document.URL 取得現在的網址,包含了 domain 與網址的各項參數。document.URL | |
document.URL.indexOf('ug5g') | |
document.URL.indexOf('com') | |
document.URL.indexOf('hk') | |
document.URL.substring(13,17) | |
document.URL.substring(18,21) | |
document.URL.length |
location.href: | |
location.protocol: | |
location.hostname: | |
location.host: | |
location.port: | |
location.pathname: | |
location.search: | |
location.hash: |
沒有留言:
張貼留言