Today, I wrote the following section in the Code:
<Script
Language = "JavaScript" type = "text/JavaScript">
<! --
Function play (URL)
{
// Alert (URL );
VaR RTN = showmodaldialog ("playmovies. aspx? Url = "+ URL, window,
"Dialogwidth: 640px; dialogheight: 480px; Status: 0;
Help: 0; scroll: 0 ;");
}
// -->
</SCRIPT>
<
Href = 'javascript: Play ("<% # server. urlencode (eval (" FILENAME "). tostring () %>"); '> watch online </a>
The code is very simple and can be run in real time (when the file name is Chinese or non-ASCII characters), it is always not running properly. Debug and view the source file. After comparison, it is found that the escape is correct, but alert is not correct in the script. Correct after changing the code to the following:
<
Onclick = 'javascript: Play ("<% # server. urlencode (eval (" FILENAME "). tostring () %> ");'
Href = "#"> watch online </a>
In fact, it hasn't changed much, and I haven't thought too much about writing code. I think it's because the browser itself has converted itself when processing something in href (the browser has used the Utf-8 to send a URL request. The strange thing is why the conversion is incorrect, or the JavaScript code is inconsistent with the browser ).
Although the problem is simple, record it. For future reference.