PDA

View Full Version : Javascript Tooltip OnClick Help please



SNICKsaturday
08-22-2007, 06:38 AM
1) Script Title: Rich-HTML Balloon Tooltip

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex5/balloontooltip.htm

3) Describe problem:
I was wondering if anyone could tell me how to change the Javascript to activate the tooltip On Click instead of on mouse over?

It would be so extremely helpful!

Or if there is a different script that would be better for this?
I wanted something like this:
http://cab.rit.edu/?s=calendar (click a calendar link)

I can't find anything closer than this Rich-HTML Baloon on DD.

Thank you for any help you can provide!

Twey
08-22-2007, 09:06 AM
Find this function:
function initalizetooltip(){
var all_links=document.getElementsByTagName("a")
if (enablearrowhead){
tiparrow=document.createElement("img")
tiparrow.setAttribute("src", arrowheadimg[0])
tiparrow.setAttribute("id", "arrowhead")
document.body.appendChild(tiparrow)
}
for (var i=0; i<all_links.length; i++){
if (reltoelement(all_links[i])){ //if link has "rel" defined and it's the ID of an element on page
all_links[i].onmouseover=function(e){
var evtobj=window.event? window.event : e
displayballoontip(this, evtobj)
}
all_links[i].onmouseout=delayhidemenu
}
}
}And instead, use:
function initalizetooltip() {
var all_links = document.getElementsByTagName("a");
if (enablearrowhead) {
tiparrow = document.createElement("img");
tiparrow.src = arrowheadimg[0];
tiparrow.id = "arrowhead";
document.body.appendChild(tiparrow);
}
var onf = function(e) {
displayballoontip(this, e || event);
document.onclick = delayhidemenu;
};
for (var i=0; i<all_links.length; i++)
if (reltoelement(all_links[i])) //if link has "rel" defined and it's the ID of an element on page
all_links[i].onclick = onf;
}

SNICKsaturday
08-23-2007, 01:43 AM
I Love You!! :d

SNICKsaturday
08-23-2007, 03:05 AM
Oops, sorry, It actually isn't working for me. Did I do it wrong?
I replaced the function you specified above.

... but the Tooltips aren't showing up at all now.

Link:
http://www.d.umn.edu/~kirbypb/test1.html


And I don't want the actual links to go anywhere but return false doesn't seem to be working either.. ?