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

Coding a hyperlink to another page

Status
Not open for further replies.

david7777777777

Programmer
Sep 26, 2001
417
US
How do you code a hyperlink in an ASP page that points to another page using VBScript or JavaScript?

 

What exactly do you mean by "How do you code a hyperlink"? "Defeat is not the worst of failures. Not to have tried is the true failure."
-George E. Woodberry
 
Below is your standard hyperlink:
<a href=PAGE YOU WANT TO LINK TO>CLICK ME TO GO TO PAGE</a>

Below will pass data:
<a href=PAGE YOU WANT TO LINK TO?varname=&quot;data&quot;>Click Me to Pass Data VIA URL</a>

 
Bad wording I guess. If someone clicks a button on my page that opens a recordset and that recordset returns no records, I want to re-direct them to another page that is already built with a message that says &quot;No results, try again.&quot; I'm not sure how to code this re-direction stuff.
 
If you are doing server side code it would be the following:

Response.buffer = True
set r = Server.CreateObject(&quot;ADODB.Recordset&quot;)
'open r with whatever records

If r.eof Then 'check to see if recordset is empty
Response.redirect &quot;EmptyRecords.asp&quot;
Else
'do stuff with the records
End If
Response.flush
'*******

If you are doing it on the client side:
//in javascript, but easy in VBScript too
var r = new ActiveXObject(&quot;ADODB.Recordset&quot;);
r.open(test,connstring)
if(r.eof){
window.navigate(&quot;EmptyRecords.htm&quot;);
}else{
//do stuff with records
}

Hope this helps,

d4v1d5e
 

Hi sophtwarez,
in your response to david77... you wrote some client side code for opening a recorset with ActiveXObject. I was wondering if this works it Netscape as well or just IE?

Thanks for your help. &quot;Defeat is not the worst of failures. Not to have tried is the true failure.&quot;
-George E. Woodberry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top