开发者

Javascript onclick and escapes

开发者 https://www.devze.com 2023-02-02 07:28 出处:网络
If my onclick event looks like: <input ....开发者_开发技巧 onclick=\"someEvent(\'blah\', \'/some/folder/?a=1\')\" />

If my onclick event looks like:

<input ....开发者_开发技巧 onclick="someEvent('blah', '/some/folder/?a=1')" />

Should the ? character be escaped?


For the purpose of passing the string parameter to someEvent, you don't need to escape the ?.

How you use the parameter in the event handler is another question, though on a URL it should be fine.


In your simplified example it's fine as is. It's no different than passing it a question, ie What is for dinner?

0

精彩评论

暂无评论...
验证码 换一张
取 消