如何传递“/”进入javascript函数 [英] How to pass "/" into javascript function
本文介绍了如何传递“/”进入javascript函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
function myfun(arg)
{
/ / 我的功能
}
< span class =code-keyword>< input type = button önclick = myfun(ARG / OPC / 123) / >
当我是点击按钮它不会命中我的功能
解决方案
在你的评论中,你说你试图传递一个字符串。请注意,字符串需要用引号括起来:
< input type = 按钮 onclick = myfun('ARG / OPC / 123') / > 跨度>
function myfun(arg)
{
//My function
}
<input type="button" önclick="myfun(ARG/OPC/123)" />
when i am clicking on button it wont hit my function
解决方案
In your comment, you said that you are trying to pass a string. Note that a string needs to be surrounded by quotes:
<input type="button" onclick="myfun('ARG/OPC/123')" />
这篇关于如何传递“/”进入javascript函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文