JavaScript inside an lt;img title=quot;lt;a href=#39;##39; onClick=#39;alert(#39;Hello World!#39;)gt;The Linklt;/agt;quot; /gt; possible?(lt;img title=quot;lt;a href=# onClick=alert(Hello World!)gt;The Linklt;/agt;quot; 中的 JavaScript/gt;可能的?)
问题描述
<img title="Jmx0O2EgaHJlZj0="#' 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="VGhlIExpbms=" /></a>
这篇关于<img title="<a href='#' onClick='alert('Hello World!')>The Link</a>" 中的 JavaScript/>可能的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:<img title="<a href='#' onClick='alert('Hello World!')>The Link</a>" 中的 JavaScript/>可能的?


- 失败的 Canvas 360 jquery 插件 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- Flexslider 箭头未正确显示 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01