473,387 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Add title inside link tag to make tooltip

Hi. I'm beginner to Javascript so my question maybe would sound dumb to you.

Anyway, I'm editing a script for my blog and a line goes like this:

document.write('<a href="' + alturl + '">' + entry.author[0].name.$t + '</a>' + ':' + ' ');

What I want is add the title="' + posttitle +'" inside the link tag to make the title of the post a tooltip. However, adding that one messes things up and the whole thing won't appear on the page anymore.
Jul 28 '07 #1
5 1634
epots9
1,351 Expert 1GB
Hi. I'm beginner to Javascript so my question maybe would sound dumb to you.

Anyway, I'm editing a script for my blog and a line goes like this:

document.write('<a href="' + alturl + '">' + entry.author[0].name.$t + '</a>' + ':' + ' ');

What I want is add the title="' + posttitle +'" inside the link tag to make the title of the post a tooltip. However, adding that one messes things up and the whole thing won't appear on the page anymore.
Hi casperrr welcome to TSDN,

try this:
Expand|Select|Wrap|Line Numbers
  1. document.write('<a href=\'' + alturl + '\' title=\''+ posttitle +'\'>' + entry.author[0].name.$t + '</a>' + ':' + ' ');
  2.  
Please next time use code tags....[ code=javascript][ /code] (without the spaces).

good luck
Jul 28 '07 #2
Hi casperrr welcome to TSDN,

try this:
Expand|Select|Wrap|Line Numbers
  1. document.write('<a href=\'' + alturl + '\' title=\''+ posttitle +'\'>' + entry.author[0].name.$t + '</a>' + ':' + ' ');
  2.  
Please next time use code tags....[ code=javascript][ /code] (without the spaces).

good luck
Thanks. The code now works. However, the tooltip would show the link tag for the postitle. That is, for example,

[HTML]<a href="http://MYBLOG.blogspot.com/2007/07/post-title.html">post title</a>[/HTML]

Other instances of "posttitle" in the script would show the real title unlike this one. I'm using Blogger by the way if that helps.
Jul 30 '07 #3
epots9
1,351 Expert 1GB
Thanks. The code now works. However, the tooltip would show the link tag for the postitle. That is, for example,

[HTML]<a href="http://MYBLOG.blogspot.com/2007/07/post-title.html">post title</a>[/HTML]

Other instances of "posttitle" in the script would show the real title unlike this one. I'm using Blogger by the way if that helps.
i don't understand what u mean...do u have live code i can see?
Jul 30 '07 #4
acoder
16,027 Expert Mod 8TB
Changed the thread title.

Please read Use a Good THread Title.
Jul 31 '07 #5
i don't understand what u mean...do u have live code i can see?
The script containing that is here.

The blog is here. The function is applied on the widget named "recent comments" below the page. If you can see, mouseover the links there and the tooltip will show the a tag for the title.

If you understand German, spare the posts. I just translated them from somewhere to act as trial posts. Hehe.

Really big thanks.
Jul 31 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: mitch gart | last post by:
Is it possible to insert newlines, or some other character, into <title> or <alt> to get the effect of a tooltip, where the page author controls the line breaks? If yes, could somebody send an...
4
by: DU | last post by:
I am looking for opinions on the issue of length of title attribute. First of all, the current HTML 4.01 spec is rather vague on this issue... at least, it isn't explicit nor normative. The HTML...
33
by: bissatch | last post by:
Hi, I fully understand the purpose of an alt attribute within a <img> tag but why would you use a title or summary attribute within, for example, a <p> tag. I have read books recommending that I...
3
by: Andy Dingley | last post by:
We've all seen this structure many times: <ul> <li><a href="..." >Click here</a></li> <li><a href="..." >Click here</a></li> </ul> Now it's obvious good practice to have sensible link texts,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.