站长资源网络编程

javascript 获取链接文件地址中第一个斜线内的正则表达式

整理:jimmy2026/8/6浏览2
简介window.location.pathname 比如: /windows/location/page.html 我想得到“windows”,请问用正则表达式怎么写? [Ctrl+A 全选 注:引入外部Js需再刷新一下页面才能执行]
window.location.pathname
比如:
/windows/location/page.html
我想得到“windows”,请问用正则表达式怎么写?

[Ctrl+A 全选 注:引入外部Js需再刷新一下页面才能执行]