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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A conditional (If) link with ASP, URGENT!

Status
Not open for further replies.

fterrazas

Technical User
Dec 29, 2000
43
ES
I want to know hox can I do something like this:
if Session("var1")=2 then
Response.Write(&quot;<a href=&quot;here comes the link&quot;>LINK1</a>&quot;)
I having problems with the quotes(&quot;) there is someway to do this?? please help me.
 
Sure...
You can either do this:

if Session(&quot;var1&quot;)=2 then
Response.Write('<a href=&quot;here comes the link&quot;>Link1</a>')

- i.e use single quotes,

or this


if Session(&quot;var1&quot;)=2 then
Response.Write(&quot;<a href=&quot;here comes the link&quot;>Link1</a>&quot;)

Moreover, if your href link does not have any speces you can put it there without quotes at all, or so I think.

Anyway, I hope it was helpful. :)


Dmitriy
dbrom@crosswinds.net
 
You could try this:

response.write &quot;<a href=&quot;&quot;here comes the link&quot;&quot;>link</a>&quot;

hope this help you,

Fredy
 
But once I tried to use:
Response.write &quot;<a href=&quot;link&quot;>Link</a>&quot;

and I got an error like:

Response.write &quot;<a href=&quot;link&quot;>Link</a>&quot;
------------------------^
Expecting end of command

or something like that
I either had to use:
&quot;<a href=&quot;&quot;link&quot;&quot;>Link</a>&quot;
or
&quot;<a href=link>Link</a>&quot;

 
Here's the skinny on using quotation marks according to a book I have:

&quot;Generall speaking, values should be enclosed in quotation marks. However, you can omit the quote marks if the value only contains letter (A-Z,a-z), digits(0-9), a hyphen(-), or a period(.)&quot;

And that goes for just about any html tag that you want to use -- styles and javascript links and I'm sure there are others excluded --

Getting quotation marks to show properly can sometimes be a real pain in the ...

I try to avoid using them unless it's in one of the situations where you would actually have to have them...

:)
Paul Prewett
 
I have two suggestions, both work for me.
1)
Code:
If Session(&quot;var1&quot;)=2 then
       Response.Write(&quot;<a href&quot; & &quot;&quot;&quot;&quot; & &quot;here comes the link&quot; & &quot;&quot;&quot;&quot; & &quot;>Link Here</a>&quot;)

2)
Code:
If Session(&quot;var1&quot;)=2 then
        %><a href=&quot;<%Response.Write(&quot;Here comes the Link&quot;)%>&quot;>Link Here</a>
   <%
 
Thanks to all for the answers, actually the one that work for my purpose was this:
response.write (&quot;<a href=&quot;&quot;here comes the link&quot;&quot;>link</a>&quot;)

and work ok, with sigle quotes it didn't work, Thanks to all

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top