0
我想在下面的示例網址中獲得「第二」。如何找到位置路徑名的第三部分?
http://www.mywebsite.com/first/sedond/third.html
「第一」 可以是任何長度。即聯繫人,圖像等
如果我使用document.location.pathname,則會得到「/first/sedond/third.html」。 如果我使用document.location.pathname [1],我會得到「f」。
如何通過使用document.location.pathname獲得「第一」部分?
在此先感謝。
我很好奇:正則表達式需要「g」標誌嗎? – 2009-07-03 00:49:00