如何在Classic ASP中使用JScript替换String

时间:2015-05-06 08:29:30

标签: asp-classic jscript

我试着替换“#34; PROCENT"到"%"在ASP文件中。
但我得到了错误:

Error "800a01b6'  
Object doesn't support this property or method
<%@ language="javascript"%>
<%
var newSpanPosBeschreibung = Request.QueryString("newSpan");
if(newSpanPosBeschreibung.indexOf("PROCENT") >= 0 ){
    newSpanPosBeschreibung = newSpanPosBeschreibung.replace(/PROCENT/g, "%");
}
//then save the [newSpanPosBeschreibung] into Databank.
%>

如何更换&#34; PROCENT&#34;到&#34;%&#34;? THX!

1 个答案:

答案 0 :(得分:6)

如果先将变量强制转换为字符串怎么办?

var newSpanPosBeschreibung = String(Request.QueryString("newSpan"));