我有这段文字:
javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$Body$test", "", true, "doc", "", false, true))
我希望获得doc
<{1}}
(
如何使用javascript获取此信息?我应该使用正则表达式吗?
答案 0 :(得分:1)
你走了。将文本字符串拆分为段并隔离第4个:
var txt = 'javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$Body$test", "", true, "doc", "", false, true))';
var myArray = txt.split(",");
var myVariable = myArray[3].trim();
alert(myVariable);