mcexario
asked on
How to go forward or go backward in ASP with an image?
I have a simple link.asp page that has a simple arrow pointing left and an arrow pointing right Below is what the ASP code for these images are:
<img src="../images/Layers_16.g if" border="0" width="26" height="26">
What I'm trying to do is to add the ocde to go backwards or go forward a web page but I'm unsure what code to use to redirect the image when it is click to go forward or backward.
Thanks,
Mark
<img src="../images/Layers_16.g
What I'm trying to do is to add the ocde to go backwards or go forward a web page but I'm unsure what code to use to redirect the image when it is click to go forward or backward.
Thanks,
Mark
Similar in Javascript
<a href="javascript:history.g o(-1)"><im g src="../images/Layers_16.g if" border="0" width="26" height="26"></a>
AND
<a href="javascript:history.g o(+1)"><im g src="../images/Layers_16.g if" border="0" width="26" height="26"></a>
Of course if the user has JS turned off, SOL.
Rockman
<a href="javascript:history.g
AND
<a href="javascript:history.g
Of course if the user has JS turned off, SOL.
Rockman
>>in ASP
ASKER
I tried this -
<a href=<% request.servervariables("H TTP_REFERE R")%>"><im g src="../images/Layers_18.g if" border="0" width="26" height="26"></a>
and it doesn't work and I get the a ' "> ' in front of the image. It looks like ASP can not interpert the href using request.servervariables. When I hit the image I get this in the URL - http://localhost/sigtech/<%
Any ideas?
<a href=<% request.servervariables("H
and it doesn't work and I get the a ' "> ' in front of the image. It looks like ASP can not interpert the href using request.servervariables. When I hit the image I get this in the URL - http://localhost/sigtech/<%
Any ideas?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry for the typo's, but it still doesn't work. Here's my corrected code -
<a href="<% request.servervariables('H TTP_REFERE R') %>"><img src="../images/Layers_18.g if" border="0" width="26" height="26"></a>
I originally had double quotes around the HTT_REFERER enum but it was taken as the second double quote for the href.
Now I get this when I hit the image on the URL -
http://localhost/sigtech/<%%20request.servervariabl es('HTTP_R EFERER')%2 0%>
Please note that I've tried the <%= and the <% (as above) and I get the same behavior with both.
Thanks,
Mark
<a href="<% request.servervariables('H
I originally had double quotes around the HTT_REFERER enum but it was taken as the second double quote for the href.
Now I get this when I hit the image on the URL -
http://localhost/sigtech/<%%20request.servervariabl
Please note that I've tried the <%= and the <% (as above) and I get the same behavior with both.
Thanks,
Mark
Try using Response.Write
This works fine with me:
<a href='<% Response.Write(Request.ser vervariabl es("HTTP_R EFERER")) %>'><img src="../images/Layers_18.g if" border="0" width="26" height="26"></a>
This works fine with me:
<a href='<% Response.Write(Request.ser
mem99999,
<%=request.servervariables ("HTTP_REF ERER")%>, previously posted, is using response.write.
---^
= is response.write.
<%=request.servervariables
---^
= is response.write.
ASKER
These still do not work. Maybe there something in my IE settings but this is what I get for both of the above recommendations -
Using Response.Write------------ ---------- ---------- -
<a href='<%= Response.Write(Request.ser vervariabl es("HTTP_R EFERER")) %>'><img src="../images/Layers_18.g if" border="0" width="26" height="26"></a>
URL = http://localhost/sigtech/<%=%20Response.Write(Reque st.serverv ariables(" HTTP_REFER ER"))%20%>
Using %= -------------------------- ---------- ---------- -----
<a href=<%=request.servervari ables("HTT P_REFERER" )%> <img src="../images/Layers_18.g if" border="0" width="26" height="26"></a>
URL = http://localhost/sigtech/<%=request.servervariables ("HTTP_REF ERER")%
It looks the URL being created never executes the inline code. Is that correct?
Thanks,
Mark
Using Response.Write------------
<a href='<%= Response.Write(Request.ser
URL = http://localhost/sigtech/<%=%20Response.Write(Reque
Using %= --------------------------
<a href=<%=request.servervari
URL = http://localhost/sigtech/<%=request.servervariables
It looks the URL being created never executes the inline code. Is that correct?
Thanks,
Mark
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
copy what I posted without the equal sign '='
i.e.
<a href='<% Response.Write(Request.ser vervariabl es("HTTP_R EFERER")) %>'><img src="../images/Layers_18.g if" border="0" width="26" height="26"></a>
* Are you sure your server is serving ASP pages correctly?
e.g. try an asp page with only: <% Response.Write("Hello World") %>
i.e.
<a href='<% Response.Write(Request.ser
* Are you sure your server is serving ASP pages correctly?
e.g. try an asp page with only: <% Response.Write("Hello World") %>
ASKER
Thanks, chaning to .asp worked. Now that I include this page to all of my web pages is there a problem with all my pages ending in .asp as oppose to .htm?
Also, now I can go backwards how would I go forward. Is there a similar request.servervariables parameter like HTTP_REFERER. I couldn't find anything.
Thanks,
Mark
Also, now I can go backwards how would I go forward. Is there a similar request.servervariables parameter like HTTP_REFERER. I couldn't find anything.
Thanks,
Mark
>Thanks, chaning to .asp worked. Now that I include this page to all of my web pages is there a problem with all my pages ending in .asp as oppose to .htm?
None.
>Also, now I can go backwards how would I go forward. Is there a similar request.servervariables parameter like HTTP_REFERER. I couldn't find anything.
There is none. That would require the server to be clarivoiant and know what the next page is, which of course would be more work than hard coding the <a href="...">xxx</a> tag.
However, if your pages were named in a specific manner, say page1.asp, page2.asp, etc. then you could write some ASP to create the next page link so you can use a simple include for each page.
<%
page = request.servervariables("S CRIPT_NAME ")
pageno = Mid(page,InStr(page,"page" )+4,99)
pageno = CInt(Left(page,InStr(page, ".asp")-1) )
nextpage = "page" & pageno+1 & ".asp"
%>
<a href="<%=nextpage%>">Next< /a>
%>
None.
>Also, now I can go backwards how would I go forward. Is there a similar request.servervariables parameter like HTTP_REFERER. I couldn't find anything.
There is none. That would require the server to be clarivoiant and know what the next page is, which of course would be more work than hard coding the <a href="...">xxx</a> tag.
However, if your pages were named in a specific manner, say page1.asp, page2.asp, etc. then you could write some ASP to create the next page link so you can use a simple include for each page.
<%
page = request.servervariables("S
pageno = Mid(page,InStr(page,"page"
pageno = CInt(Left(page,InStr(page,
nextpage = "page" & pageno+1 & ".asp"
%>
<a href="<%=nextpage%>">Next<
%>
will take you back a page assuming you came from another page and didn't enter this page directly from a bookmark.
To go forward a page, you need to know what the page name is....
<a href="REPLACE-WITH-THE-NAM