473,769 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Add title inside link tag to make tooltip

3 New Member
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 1654
epots9
1,351 Recognized Expert Top Contributor
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
casperrr
3 New Member
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">pos t 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 Recognized Expert Top Contributor
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">pos t 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 Recognized Expert Moderator MVP
Changed the thread title.

Please read Use a Good THread Title.
Jul 31 '07 #5
casperrr
3 New Member
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
20650
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 example of how to do it? I'm interested in recent versions of IE and Netscape/Mozilla. Thanks in advance.
4
15405
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 4.01 spec and WAI mention "short message", "short description", "advisory title", "informative link title" for the title attribute. Personally, I think that having a more than 128 characters tooltip does not meet the original goals of the HTML...
33
3305
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 use them but why? Does this enhance accessibility? Please provide reasons why one would want to use these? Thanks Burnsy
3
2203
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, and also sensible use of title attributes on either the<a> or <li> elements. What's a good rule of thumb for these attributes ?
0
9420
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9984
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9851
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8863
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7401
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5293
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3556
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2811
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.