Two points which need to pay attention when applying:
(1) Use single quote for parameter in Javascript function
e.g. foo is a Javascript fcuntion; value is a JSP variable.
onclick="foo('<%=value%>');"
(2) Use following Javascript function to encode String containing
special characters (e.g. ";" "\r")
You have 3 options:
(1) Use single quote for parameter in Javascript function
e.g. foo is a Javascript fcuntion; value is a JSP variable.
onclick="foo('<%=value%>');"
(2) Use following Javascript function to encode String containing
special characters (e.g. ";" "\r")
You have 3 options:
escape()will not encode:@*/+encodeURI()will not encode:~!@#$&*()=:/,;?+'encodeURIComponent()will not encode:~!*()'
References:
Comments
Post a Comment