inline javascript in href [英] inline javascript in href

查看:117
本文介绍了inline javascript in href的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



How can you do something like this:

<a href="some javascript statement that isn't a function call;" >myLink</a>

并且在链接被点击时让hs中的js执行。

And have the js in the href execute when the link is clicked.

推荐答案

<a href="javascript:var hi = 3;" >myLink</a>

现在您可以在任何地方使用 hi 3

Now you can use hi anywhere to get 3.

这篇关于inline javascript in href的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆