JavaScript inside an >” />

前端 未结 5 1859
[愿得一人]
[愿得一人] 2021-02-13 04:52
The Link\" /> 

So I\'ve got some specific question.. I already know

相关标签:
5条回答
  • 2021-02-13 05:30

    Im my browser, this doesn't work at all. The tooltip field doesn't show a link, but <a href='#' onClick='alert('Hello World!')>The Link</a>. I'm using FF 3.6.12.

    You'll have to do this by hand with JS and CSS. Begin here

    0 讨论(0)
  • 2021-02-13 05:31

    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.

    Is this what you're trying to do?

    <a href="#" onClick="alert('Hello World!')"><img title="The Link" /></a>
    
    0 讨论(0)
  • 2021-02-13 05:31

    When you click on the image you'll get the alert:

    <img src="logo1.jpg" onClick='alert("Hello World!")'/>
    

    if this is what you want.

    0 讨论(0)
  • 2021-02-13 05:32
    <img title="<a href="javascript:alert('hello world')">The Link</a>" /> 
    
    0 讨论(0)
  • 2021-02-13 05:42

    no, you can't do that, but you can use event handlers to change the title:

    <img src="foo.jpg" onmouseover="this.title='it is now ' + new Date()" /> 
    
    0 讨论(0)
提交回复
热议问题