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

How to handle special characters in window.showModalDialog parameter transfer_javascript skills

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

The program has not been modified and has been running normally. Suddenly one day, a colleague informed me that an error had occurred. After inspection, it was found that special characters such as # appeared in the transmitted data. The browser only retrieved the data before the # sign, and the subsequent data was truncated. Then I first thought of encoding the data using the Server.UrlEncode method. Although you can see that the special characters have been encoded, the correct data is still not passed and the error remains.

Copy code The code is as follows:

"JavaScript:window.showModalDialog('Info.aspx? bh=" Server.UrlEncode(e.Row.Cells.FromKey("number").Text.Trim()) "',null,'dialogWidth:750px;dialogHeight:500px;center:yes;status:no;resizable: yes;');"

After using the Escape method, the parameters are passed normally:
Copy code The code is as follows:

"JavaScript:window.showModalDialog('Info.aspx?bh=' escape("" e.Row.Cells.FromKey("number").Text.Trim( ) ""),null,'dialogWidth:750px;dialogHeight:500px;center:yes;status:no;resizable:yes;');"

But if you do not use a modal window but directly If you use Server.UrlEncode to open the link address, there will be no problem. It's very strange. Can anyone give me some advice?
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