Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何获取页面的id。
如果你能帮忙。
谢谢
如果您一直期望它是 url 的最后一部分,那么您可以这样做:
var splits = window.location.pathname.split('/'); var id = -1; if(splits.length > 0) id = splits[splits.length -1];