473,503 Members | 1,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

bookmarklet: tooltips on links

Here's a neat bookmarklet for putting tooltips on links. I got the idea
a long time ago somewhere and made it much better than it started out.

javascript:dl=document.links;for(i=0;i<dl.length;i ++)dl[i].title==""?dl[i].title=dl[i].href:dl[i].title.substring(dl[i].title.length-dl[i].href.length,dl[i].title.length)!=dl[i].href?dl[i].title+=": "+dl[i].href:dl[i].title=dl[i].title;df=document.forms;for(j=0;j<df.length;j++)d f[j].title=df[j].action;void(null)

Broken up into readable lines, that's

javascript:dl=document.links;for(i=0;i<dl.length;i ++)dl[i].title==""?
dl[i].title=dl[i].href:dl[i].title.substring(dl[i].title.length-dl[i]
..href.length,dl[i].title.length)!=dl[i].href?dl[i].title+=": "+dl[i].
href:dl[i].title=dl[i].title;df=document.forms;for(j=0;j<df.length;
j++)df[j].title=df[j].action;void(null)

Copr. 2004 Michael Hamm.

Michael Hamm Since mid-September of 2003,
AM, Math, Wash. U. St. Louis I've been erasing too much UBE.
ms****@math.wustl.edu Of a reply, then, if you have been cheated,
http://math.wustl.edu/~msh210/ Likely your mail's by mistake been deleted.
Jul 20 '05 #1
1 1260
Michael Hamm <ms****@math.wustl.edu> writes:
Here's a neat bookmarklet for putting tooltips on links. I got the idea
a long time ago somewhere and made it much better than it started out.

javascript:dl=document.links;for(i=0;i<dl.length;i ++)dl[i].title==""?dl[i].title=dl[i].href:dl[i].title.substring(dl[i].title.length-dl[i].href.length,dl[i].title.length)!=dl[i].href?dl[i].title+=": "+dl[i].href:dl[i].title=dl[i].title;df=document.forms;for(j=0;j<df.length;j++)d f[j].title=df[j].action;void(null)

Cute, but I'm sure it can be done shorter :)

<URL: javascript:var D=document,d=D.links,h,i,c;for(i=0;i<d.length;i++) {c=d[i];t=c.title;h=c.href;c.title=t?t.indexOf(h)>=0?t:t+ ": "+h:h;}d=D.forms;for(i=0;i<d.length;i++){d[i].title=d[i].action;}D=void 0; >

Except for the "void 0;" at the end, it even passes JSLint.
(There seems to be no way to make JSlint accept "void").
Broken up into readable lines, that's


Readable?!?
Shorter would be correct! :)

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
The content of this message is hereby placed into the public domain.

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1864
by: Kim Scarborough | last post by:
I found this bookmarklet that will go to a random link on the currently open page: javascript:void(location.href=document.links) Could this be changed to go to a random link from the bookmarks...
2
1357
by: Gaikokujin Kyofusho | last post by:
Hi, I am trying to find a wikipedia bookmarklet for Opera that would allow me to lookup something highlighted on a page. I could have sworn that the one i had worked until i had to reinstall opera...
1
1741
by: Robert Oschler | last post by:
In pre-Windows XP Internet Explorer, adding a bookmarklet for a user was really simple. All I add to do was create a link that executed addFavorite(). Internet Explorer under Windows XP won't...
1
5878
by: OtisUsenet | last post by:
Hi, I have a bookmarklet that works perfectly in Firefox, IE, Konqueror, and Opera, but in Safari 2.0.3 (417.9.2) it doesn't work. I enabled debugging and I can see "TypeError - Undefined...
1
1993
by: DP413 | last post by:
Hey guys need your help :) I'm trying to clone a nodelist in a bookmarklet so that I can use document.write to output each item in the nodelist to the browser. Right now I'm basically grabbing...
25
2556
by: bweaverusenet | last post by:
Hi. I am trying to get some javascript to work in IE6, from the address line. It works in Firefox and, I believe, IE7. It appears that with some number of nested structures, the code does not...
0
7063
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7313
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6970
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5558
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4987
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3156
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1489
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
366
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.