问题描述
<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/>可能的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!





大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)