回复 10楼 sdta
老师,真是太厉害了
mc = "北京大学" ? mc bm1 = encodeURI(mc) ? "一次编码:"+bm1 bm2 = encodeURI(bm1) ? "二次编码:"+bm2 ? "一次解码:"+decodeURI(bm2) ? "二次解码:"+decodeURI(decodeURI(bm2)) RETURN FUNCTION encodeURI(cUnencoded) LOCAL jsCode, oSC TEXT TO jsCode TEXTMERGE NOSHOW PRETEXT 7 function encode(unencoded) { return encodeURIComponent(unencoded).replace(/'/g,"%27").replace(/"/g,"%22"); } ENDTEXT oSC = CREATEOBJECT("ScriptControl") oSC.Language = "JavaScript" oSC.AddCode(jsCode) RETURN oSC.run("encode", cUnencoded) ENDFUNC FUNCTION decodeURI(cEncoded) LOCAL jsCode, oSC TEXT TO jsCode TEXTMERGE NOSHOW PRETEXT 7 function decode(encoded) { return decodeURIComponent(encoded.replace(/\+/g, " ")); } ENDTEXT oSC = CREATEOBJECT("ScriptControl") oSC.Language = "JavaScript" oSC.AddCode(jsCode) RETURN oSC.run("decode", cencoded) ENDFUNC
[此贴子已经被作者于2022-1-7 19:21编辑过]