如何在 Classic 中使用 JScript 替换字符串 ASP

How to replace String by Using JScript in Classic ASP

我尝试将 "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.
%>

如何将"PROCENT"替换为“%”?谢谢!

如果先将变量转换为字符串会怎样?

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