Formatting a string as a hyperlink

This is a discussion on "Formatting a string as a hyperlink" within the Classic ASP section. This forum, and the thread "Formatting a string as a hyperlink are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Nov 30th, 2003, 16:28
New Member
Join Date: Nov 2003
Location: USA
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Formatting a string as a hyperlink

Forgive the probably simple problem for you folks but here's what I'd like to do

I need to format the following string (ouputted from an access database) as a hyperlink opened in a new window

<td><%=(rsLinks.Fields.Item("url").Value%></td>

I've tried various permutations of this but nothing formats it properly

Your suggestions would be appreciated

John

  #2 (permalink)  
Old Nov 30th, 2003, 19:10
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
There's a lot of ways to do this but the simplest is
Code: Select all
<td>" target="_blank"><%= rsLinks.Fields.Item("url").Value%></td>
There should be a space after the 'a' in 'ahref' (forum tried to make it into a link without it). And I would use the shorthand for
Code: Select all
 rsLinks.Fields.Item("url").Value
which is
Code: Select all
 rsLinks("url")
  #3 (permalink)  
Old Nov 30th, 2003, 22:33
New Member
Join Date: Nov 2003
Location: USA
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks very much that worked like a charm
  #4 (permalink)  
Old Dec 1st, 2003, 13:07
Junior Member
Join Date: Nov 2003
Location: United Kingdom
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
I don't know how confident you are that the URLS in your database all have http:// in front of them, but I know that in the past I have had to check it was there so this might be useful.

'## 1st put the DB field into a temporary string
strURL = rsLinks("url")

'## now see if the first 4 characters or strURL are "http" and if not, make it so they are "http://"
If Lcase(Left(strURL,4))<>"http" then
strURL="http://" & strURL
End if

Then use the same code as earlier

<td><%=strURL%></td>
Closed Thread

Tags
formatting, string, hyperlink

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hyperlink Rollovers crackafaza Web Page Design 3 Aug 24th, 2007 11:43
Hyperlink buttons scoopslack Flash & Multimedia Forum 3 Mar 8th, 2007 13:02
Javascript Hyperlink kato77 JavaScript Forum 1 Feb 11th, 2006 12:14
Returning result from db as a hyperlink lobster1983 PHP Forum 2 Sep 18th, 2005 19:59


All times are GMT. The time now is 10:00.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43