Home > Web Front-end > JS Tutorial > body text

JS saving, reading, line wrapping, Json conversion error handling methods_javascript skills

WBOY
Release: 2016-05-16 17:32:13
Original
1278 people have browsed it

Exception information: Unexpected token ILLEGAL

Let’s talk about the processing method first:
1. Save:

Copy code The code is as follows:

varcont=encodeURI($("#txtMessage_Content").val()).replace(/ /g,"brHH");

2. Read:
Copy code The code is as follows :

entity[i].Contents.replace(//,">").replace(/brHH/g ,"
")

Explanation:
The main idea is the substitution method.
JS seems to be unable to capture the text directly. Press Enter and encodeURI to capture it.
Copy code The code is as follows:

replace(//,">")

This sentence deals with JS injection
Copy code The code is as follows:

replace(/brHH/g,"
")

Here is replacing the above with Enter Replace and display
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template