javascript下Ajax技术怎么让特殊字符当做字符串?代码如下

2025-03-07 06:00:55
推荐回答(5个)
回答1:

可以用uriencode或escape对字符串编码,如果有英文引号则用反斜杠转义。

回答2:

用特殊字符的实体编码代替字符,如用<代表<,>代表>, "e;代表双引号, &代表&等。

回答3:

js中的特殊字符,加上转义符\ 。
例如:
var txt="We are the so-called "Vikings" from the north." document.write(txt) 【错误】
var txt="We are the so-called \"Vikings\" from the north." document.write(txt) 【正确】

回答4:

对特殊字符编码

回答5:

这跟ajax有什么联系?