的第一部分,如果我有一個網址,如:得到一個URL路徑
http://localhost:53830/Organisations/1216/View
我想提醒如以小寫格式的URL路徑的第一部分'組織'
到目前爲止,我有:
var first = $(location).attr('pathname');
first.indexOf(1);
first.replace('/', '');
first.toLowerCase();
alert(first);
但預期它不工作。誰能幫忙?由於
@YuriyFaktorovich不在英國,不是;) – Curt
.indexOf有什麼用? – Eduardo
那是因爲你英國人不會說適當的英語;或者也許我們美國人只是認爲我們知道一切;)Dogbert的回答看起來很穩固,btw – Kato