Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 13th, 2004, 09:40 AM
Authorized User
 
Join Date: Sep 2004
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.

 
Old October 13th, 2004, 11:32 AM
Friend of Wrox
 
Join Date: Jun 2003
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
 
Old October 13th, 2004, 11:42 AM
Authorized User
 
Join Date: Sep 2004
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"">")
-----------------------------------------------------------------------^
 
Old October 13th, 2004, 01:03 PM
Friend of Wrox
 
Join Date: Jun 2003
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
 
Old October 13th, 2004, 01:11 PM
Authorized User
 
Join Date: Sep 2004
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.
 
Old October 13th, 2004, 02:20 PM
Friend of Wrox
 
Join Date: Jun 2003
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
 
Old October 21st, 2004, 10:12 PM
Registered User
 
Join Date: Oct 2004
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>")


 
Old October 21st, 2004, 10:34 PM
Friend of Wrox
 
Join Date: Jan 2004
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
 
Old October 22nd, 2004, 07:18 AM
Friend of Wrox
 
Join Date: Jun 2003
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
 
Old October 24th, 2004, 06:46 AM
Friend of Wrox
 
Join Date: Jun 2003
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





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.