Forum Moderators: open
I need to know how I would show a title for each image when the image is hovered over (like alt)to add to this script. Here is the script as it is now...the "testtitle" is where I am trying to add the image title, just as the image source and image link are added.
arr=[
["image1.gif","page1.htm"],
["image2.gif","page2.htm","testtitle"] // no comma at the end of last index
]
now=new Date()
nowDate=now.getDate()
function changeImg(){
if(nowDate>arr.length){
return
}
document.getElementById("img").src=arr[nowDate-1][0]
document.getElementById("link").href=arr[nowDate-1][1]
document.getElementById("title").title=arr[nowDate-1][2]
}
And this is in the body section of the page...
<BODY onload="changeImg()">
<a href="#" id="link" target="_blank"><img border="0" image id="img"><image title id="title"></a>
As it works right now a small box is next to the image itself and the "testtitle" does show when you hover over the small box. But I would like "testtitle" or (whatever title text I want to use) to show
over the image instead when it is hovered over like it is supposed to.
Hope someone can help, thanks! Simone
try:
<a href="#" id="link" target="_blank" title="testtitle"><img border="0" image id="img"></a>
As you can see I have buried the title inside the a href line, this works fine for me and is quoted as what should be done in text books too dude.
Not sure why you need the <img border="0" image id="img">though!
Geoff
I want the title to change daily along with the rest of these. Sorry I didn't explain that better before you had to look through my code. Even though your answer makes perfect sense and is the usual way, it won't work for changing the title daily along with the rest. Thanks for the help though. Simone
would like to be able to answer your question, BUT can't...he he!
am sure the experts here will though.
although not too sure why its so important for you to have this box appear anyway dude, it take a second or two for theese to appear and many people wont wait that long, they will just see that the image links somewhere and click it if they want....well I do anyway.
good luck
geoff