href url 使用原型js库匹配
Href url match using prototype js library
在我的系统中,我使用的是原型js。
现在我想match any href with using href.match and do want something
。
尝试完成一些事情,但它会产生问题 express
Suppose: my url
www.example.com/customer/account/login/an/aaa?333=sddssdsd,sasaas
想点赞:
如果任何 href 包含 customer/account/login/
那么我的条件应该有效。
试试下面这个:
if(accountlink.href.match(/\/customer\/account\/login\//)){
//do someting
}
但这是条件,我也在工作 url:
www.example.com/customer/account/aaa/
www.example.com/aaa/account/login/an/
我不想这样。
如果 href 包含 customer/account/login/
就可以了。
请帮帮我。
您可以使用原版 javascript 来执行此操作:
var url = 'www.example.com/customer/account/login/an/aaa?333=sddssdsd,sasaas'
if (url.indexOf('customer/account/login/') > -1) {
// Do your stuff
}
在我的系统中,我使用的是原型js。
现在我想match any href with using href.match and do want something
。
尝试完成一些事情,但它会产生问题 express
Suppose: my url
www.example.com/customer/account/login/an/aaa?333=sddssdsd,sasaas
想点赞:
如果任何 href 包含 customer/account/login/
那么我的条件应该有效。
试试下面这个:
if(accountlink.href.match(/\/customer\/account\/login\//)){
//do someting
}
但这是条件,我也在工作 url:
www.example.com/customer/account/aaa/
www.example.com/aaa/account/login/an/
我不想这样。
如果 href 包含 customer/account/login/
就可以了。
请帮帮我。
您可以使用原版 javascript 来执行此操作:
var url = 'www.example.com/customer/account/login/an/aaa?333=sddssdsd,sasaas'
if (url.indexOf('customer/account/login/') > -1) {
// Do your stuff
}