First look at the example
| The code is as follows |
Copy Code |
| function WebChart () { var t = document.getElementById ("txtreceive"); if (T.value = null | | t.value = = "") { Alert ("Please inquire first"); } else {
alert (T.value); document.getElementById ("Center-iframe"). src = "map/industrymap.aspx?_indeustry=" + t.value; }} |
This time alert comes out of the code is very normal, are Chinese characters.
But it's garbled when you get it in the background.
| The code is as follows |
Copy Code |
protected void Page_Load (object sender, EventArgs e) { Industry = request.querystring["_indeustry"]. ToString ();
Initmap (); Getshowmuilt (); } |
Web.config has been configured for UTF-8, but not yet.
| The code is as follows |
Copy Code |
<system.web> <globalization culture= "en-en" and "uiculture=" requestencoding= "UTF-8" responseencoding= "UTF-8" fileencoding= "UTF-8"/> </system.web> |
Final Solution
| The code is as follows |
Copy Code |
| function WebChart () { var t = document.getElementById ("txtreceive"); if (t.value = null | | t.value = = "") { ; alert ("Please inquire first"); } else { var url = encodeURI ("map/industrymap.aspx?_indeustry= "+ T.value); alert (URL); document.getElementById ("Center-iframe"). src = URL; } } |
The
results are as follows: