看板 [ Ajax ]
討論串[問題] 在switch用星號或正規式?
共 2 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓1(1推 0噓 1→)留言2則,0人參與, 最新作者scribeTW (scribe)時間14年前 (2011/05/31 22:43), 編輯資訊
0
0
2
內容預覽:
var loc = document.location.href;. if(loc.indexOf("http://www.google.com/") != -1){. alert("OK1");. }else if(loc.match(/^http:\/\/www\.google\.com\/.*

推噓1(1推 0噓 0→)留言1則,0人參與, 最新作者pthuang (◢曉筱◤)時間14年前 (2011/05/31 22:16), 編輯資訊
0
0
1
內容預覽:
有沒有可能讓 switch 會吃星號(*)或正規表示式呢?. 我現在在 GreaseMonkey 中寫了一段. switch (document.location.href). {. case 'http://www.google.com/*'://←這只是範例 實際上網址最後是浮動的. alert
首頁
上一頁
1
下一頁
尾頁