Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 13th, 2004, 09:40 AM
Authorized User
 
Join Date: Sep 2004
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default response.write open link in new window

Im trying to have the link open in a new window can someone please help me.. Thanks,

Code:
If rsArticles ("local") then
                Response.Write rsArticles("link_"&strLang)&"_"&strLang&".asp"
            else
                Response.Write rsArticles("link_"&strLang)


Its in the else that I want to open link_ in new window.

Thanks again.

Reply With Quote
  #2 (permalink)  
Old October 13th, 2004, 11:32 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Write the whole link in the response.Write, put in the else:

else
  Response.Write("<a href=""" & rsArticles("link_" & strLang) & ".asp""" target=""_blank"">")

Brian
Reply With Quote
  #3 (permalink)  
Old October 13th, 2004, 11:42 AM
Authorized User
 
Join Date: Sep 2004
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It gives me this error?

Code:
Microsoft VBScript compilation error '800a03ee' 

Expected ')' 

/incl/articleindex.asp, line 72 

Response.Write("<a href=""" & rsArticles("link_" & strLang) & ".asp""" target=""_blank"">")
-----------------------------------------------------------------------^
Reply With Quote
  #4 (permalink)  
Old October 13th, 2004, 01:03 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Change
".asp""" target

to

".asp"" target

I removed one of the group of three ". There was one too many.

Sorry about that.

Brian
Reply With Quote
  #5 (permalink)  
Old October 13th, 2004, 01:11 PM
Authorized User
 
Join Date: Sep 2004
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey no problem...

I tried it and this is what shows up as the link:

Code:
Check out all the activities and events planned and learn what you can get involved in (external link). ">More»
In front of the More link also it does open a new window but the link is not taken from the database no more it takes the root main page to show in the browser and this is the URL that shows up in the address bar that gives me a 404 error:

http://cadets-dev.ottawa-hull.mil.ca/<a%20href=

Please help..



Thanks.
Reply With Quote
  #6 (permalink)  
Old October 13th, 2004, 02:20 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Try:

Response.Write("<a href=""" & rsArticles("link_" & strLang) & ".asp"" target=""_blank"">More>></a>")

The link wasn't ended.

Brian
Reply With Quote
  #7 (permalink)  
Old October 21st, 2004, 10:12 PM
Registered User
 
Join Date: Oct 2004
Location: Elma, NY, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have a session variable that I would like to output as a link. I am sure it is a syntax error.
    Response.Write ("<a href =""& Session("fname")"">click here</a>")


Reply With Quote
  #8 (permalink)  
Old October 21st, 2004, 10:34 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Response.Write ("<a href ='" & Session("fname") & "'>click here</a>")

The brackets are optional, you could also:

Response.Write "<a href ='" & Session("fname") & "'>click here</a>"

Are you using a code editor? EG Homesite If not you should probablt start,
the color coding assists you very well in this situation

BTW: Next time start your own post. This way things are catagorized properly assisting others to find solutions (the title of this post does not match your problem/solution)

Wind is your friend
Matt
Reply With Quote
  #9 (permalink)  
Old October 22nd, 2004, 07:18 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

For you it's the double-quotes that are giving you problems:

Response.Write ("<a href ="""& Session("fname") & """>click here</a>")

Matt's solution is probably better because using single-quotes for attributes makes it easier to read, in my opinion.

Brian
Reply With Quote
  #10 (permalink)  
Old October 24th, 2004, 06:46 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Yes, using single quotes within the string is much readable. Actually to use double quotes within a string, one has to use 2 double quotes, so that the second negates the special meaning of the first and makes it appear once there.
Code:
Response.write "This is my Quote - ""Live or Let Live"""
The quotes marked in red in the above code makes sure that Live or Let Live appear within double quotes.
This is my Quote - "Live or Let Live"

Cheers!

_________________________
- Vijay G
Strive for Perfection
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
putting a link into a response.write pablohoney Classic ASP Basics 1 October 2nd, 2006 01:45 PM
Open Window and Write HTML to Child Advice fs22 Javascript How-To 3 August 6th, 2005 02:04 PM
response.write crmpicco Classic ASP Basics 1 January 27th, 2005 06:31 PM
response.write netcrawler Classic ASP Databases 4 September 29th, 2004 10:13 AM
Response.write Sach Classic ASP Components 5 March 19th, 2004 06:40 AM



All times are GMT -4. The time now is 03:31 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.