- 1
How to show the name of object when we drag the mouse upon the obj. In html
it didnt work
4 Antworten
+ 4
Try to use the 'title' attribute for that (it's not the purpose of 'alt' attribute, which is mandatory...)
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/title
+ 1
@Rajat Rawal:
In addition to the fact that thread is about 6 month old now, and asker seems to not be active from about 3 month, the question was already correctly answered, without any JS requirement ^^ (check the link about 'title' attribute to convince yourself ;P)
And anyway, using alert() inside a 'mouseover' event listener is a very bad idea... At most, use console.log() for debug purpose, or even any html element innerHTML content to display the information wanted, and hide it on 'mouseout' event...
0
It needs javaScript.
You can just write the following syntax : -
<element onmouseover="myScript">
In your case, you can write --
<img onmouseover="alert("my car");" src="abc.jpg" alt="my car">
- 1
alt="my