<img title="<a href='#' onClick='alert('Hello World!')>The Link</a>" />
所以我有一些具体的问题.我已经知道我可以使用 TITLE 属性中的属性.但是我可以使用 TITLE 属性中的事件吗?
So I've got some specific question.. I already know that I can work with attributes inside a TITLE attribute.. But can I work with events inside a TITLE attribute?
(顺便说一句 - 这似乎是一个垃圾代码,但这已经在我的 Web 项目中按原样工作了 - 我只需要一种在这个带鞘链接上使用一些 Javascript 的方法.)
(btw - It seems like a rubbish code, but this already works as is should on my web project - I just need a way to use some Javascript on this sheathed link.)
我使用 Jquery 框架.
不,正如你所说的垃圾代码".如果它正常工作,那是因为浏览器试图读懂作者的想法"——换句话说,它们有算法试图理解垃圾代码",猜测可能的意图并在内部将其更改为实际的东西有道理.
No, this is, as you say "rubbish code". If it works as should, it is because browsers try to "read the writer's mind" - in other words, they have algorithms to try to make sense of "rubbish code", guess at the probable intent and internally change it into something that actually makes sense.
换句话说,您的代码只能在偶然的情况下运行,而且可能并非在所有浏览器中都有效.
In other words, your code only works by accident, and probably not in all browsers.
这是你想要做的吗?
<a href="#" onClick="alert('Hello World!')"><img title="The Link" /></a>
这篇关于<img title="<a href='#' onClick='alert('Hello World!')>The Link</a>" 中的 JavaScript/>可能的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!