Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make results[i].getAttribute display a url from value

Status
Not open for further replies.

gareth001

Technical User
Feb 4, 2003
43
GB
I've got an xml file that I'm placing into a table, one field at a time with Java. I can happily place the values as string, but can't get the syntax correct to place as a URL.

Simple string:

Code:
document.write('<td>' + results[i].getAttribute("age") + '</td>');

Attempt at href:

Code:
document.write('<td>' + "<A href=results[i].getAttribute("html")>" + '</td>');

A quote is the epiphany of intelligence
 
Hi

Maybe like this ?
Code:
document[teal].[/teal][COLOR=darkgoldenrod]write[/color][teal]([/teal][green][i]'<td><A href="'[/i][/green] [teal]+[/teal] results[teal][[/teal]i[teal]].[/teal][COLOR=darkgoldenrod]getAttribute[/color][teal]([/teal][green][i]"html"[/i][/green][teal])[/teal] [teal]+[/teal] [green][i]'"></td>'[/i][/green][teal]);[/teal]


Feherke.
 
Afraid that just leaves me with an empty cell in the table with no boarders where the URL should be.

A quote is the epiphany of intelligence
 
Hi

Well, then you will have to give us details :
[ul]
[li]what is returned by [tt]results.getAttribute("html")[/tt][/li]
[li]where is that [tt]document.write()[/tt] called[/li]
[/ul]


Feherke.
 
Incomplete Link Feherke:

Code:
document.write('<td><A href="' + results[i].getAttribute("html") + '">[red]Link Text </a>[/red]</td>');

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Thanks - knew it was something simular to what I had. Now working.

A quote is the epiphany of intelligence
 
Its o.k, it happens to all of us once in a while.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top