0

我有一个 javascript 变量

var url =  http://www.abc.it/it/security/security.aspx?security=pdfcompare&../securitycomparepdf/default.aspx?SecurityTokenList=blab]2]0]blab$ALL|blab]2]0]blab$ALL|blab]2]0]blab$ALL;

我需要"../securitycomparepdf/default.aspx?"使用 jquery 从中删除部分,以便变量变为

http://www.abc.it/it/security/security.aspx?security=pdfcompare&SecurityTokenList=blab]2]0]blab$ALL|blab]2]0]blab$ALL|blab]2]0]blab$ALL;

有人可以建议吗?

谢谢

4

2 回答 2

1

为你做了一个演示:http: //jsfiddle.net/B3Uwj/27/(来自@tats_innit)

url = url.replace("../securitycomparepdf/default.aspx?", "");
于 2012-05-31T10:48:27.597 回答
1

使用以下 JS

var url = "http://www.abc.it/it/security/security.aspx?security=pdfcompare&../securitycomparepdf/default.aspx?SecurityTokenList=blab]2]0]blab$ALL|blab]2]0]blab$ALL|blab]2]0]blab$ALL";

url = url.replace("../securitycomparepdf/default.aspx?","");

​alert(url);​

在此处查看实时示例

于 2012-05-31T10:49:52.300 回答