Current location: Hot Scripts Forums » General Web Coding » JavaScript » Problem creating dynamic title for anchors


Problem creating dynamic title for anchors

Reply
  #1 (permalink)  
Old 05-14-04, 04:17 AM
GO4TF4CE's Avatar
GO4TF4CE GO4TF4CE is offline
Wannabe Coder
 
Join Date: Apr 2004
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
Problem creating dynamic title for anchors

Hi,

This is a relatively simple problem, I am trying to make a basic anchor have a dynamic title attribute, this is some of the code that should work.

I am trying to get the text with the link and not the href.

<A HREF="test.asp" onmousemove="javascript:this.title=this.text">test </A>

for some reason this is only returning an undefined value. Its probably something simple.

Any Ideas?
__________________
Intelligence is not knowledge, but the way we use our knowledge.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 05-15-04, 03:17 PM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
use .innerHTML or .innerText instead, same for most tags...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 05-16-04, 11:15 AM
GO4TF4CE's Avatar
GO4TF4CE GO4TF4CE is offline
Wannabe Coder
 
Join Date: Apr 2004
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
Though that does work on the likes of div tags etc, it seems to be a problem when using the anchor tags, I have tried both of those methods and they return "undefined".

Quote:
Originally Posted by TwoD
use .innerHTML or .innerText instead, same for most tags...
__________________
Intelligence is not knowledge, but the way we use our knowledge.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 05-16-04, 03:54 PM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
I just tried (again) with .innerHTML and .innerText and it works for divs and anchor tags without any problems in IE....

Which browser are you using?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 05-16-04, 04:23 PM
GO4TF4CE's Avatar
GO4TF4CE GO4TF4CE is offline
Wannabe Coder
 
Join Date: Apr 2004
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
Its ok, I've just tried it on my home pc, seems to be an issue with the computer at work, sorry for wasting everyones time, doh.

cheers for help anyway.

Quote:
Originally Posted by TwoD
I just tried (again) with .innerHTML and .innerText and it works for divs and anchor tags without any problems in IE....

Which browser are you using?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Classified Ads skipper23 Perl 3 11-22-05 03:22 AM
ASP dynamic button problem kasic ASP 2 05-10-04 10:17 AM
Dynamic title hyperrad Perl 1 02-09-04 06:15 PM
Problem creating a countdown table Req JavaScript 0 01-08-04 09:17 PM
Classified Ads skipper23 Perl 2 12-30-03 04:43 AM


All times are GMT -5. The time now is 01:24 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.