4
Contributors
6
Replies
24
Views
3 Years
Discussion Span
Last Post by albucurus
0

you are asking in the wrong forum.
for jsp, there is a separate jsp forum.

also: you are trying to mix javascript (not java) with html, which is not really java/jsp related, maybe you should consider posting it in the Javascript forum

0

What event do you want to happen to initiate the process of getting the value in the function into the title attribute?

<body onload="a()"> 

<script>
function a(){
   var filename="test.txt";
   document.getElementById("img1").title=filename;
} 
</script>

<img id="img1" src="img/test.png" title="?"/>

</body>
0

on mouseHover event I want to display the title of image tag, which is by default event.

my question is how to get value of fileName in title attribute?

0

Hi,
Do you want to display the file name from src in title of img tag?
You can use this, dont need javascript for that:
<img src="img/test.png" title="test.png"/>

0

I want value of variable, "filename" not the static file name.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.