PDA

View Full Version : Jumping To.........


misti
09-11-2002, 09:04 AM
Hi, I'm new here, hope everyone is doing well. I need some assistance please. I have searched for the code and info on how to do this, but can't find it. May be because I'm not exactly sure how it is titled. Let me explain what I'm trying to do and maybe someone here can assist me.

I'm wanting to create a FAQ page like a lot that I see. What happens is someone clicks on the question and when they do they are taken, in the same page, down to that question, then under the question they can click on "Back To Top" or etc... to return to the top of the questions, click on another question, and be taken to that question, etc... If you don't understand let me know. That is about as best I can think to explain what I'm wanting to do. All help appreciated. Thanks in advance.

glenngv
09-11-2002, 09:37 AM
<html>
<body>
<a name="top"></a>
FAQ goes here...
<a href="#faq1">FAQ No. 1</a>
...
<a href="#faq2">FAQ No. 2</a>
...


...
<a name="faq1"></a>
FaQ#1:
blah blah blah
<a href="#top">Back to Top</a>
...
<a name="faq2"></a>
FaQ#2:
blah blah blah
<a href="#top">Back to Top</a>
...
...
</body>
</html>

whammy
09-11-2002, 04:33 PM
That's what I do pretty much. Here's an example of a working way to dynamically generate something like this from a database (using ASP).


<% @Language="VBScript" %>
<html>
<head>
<title>Common Responses</title>
<script language="javascript" type="text/javascript">
<!--
function copytext(){
var txtRange = document.selection.createRange();
txtRange.execCommand('Copy');
return true;
}
// -->
</script>
</head>

<body>

<a name="top" /><h3>Common Responses</h3>

<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DSN=DSNSQLCS;UID=sqlcs;PWD=cssql;"

ResponseQuery = "SELECT * FROM TBL_RESPONSES WHERE ClientID = '7' ORDER BY Title DESC"
'Response.Write(ResponseQuery) : Response.End
Set rs = Conn.Execute(ResponseQuery)

Do While NOT rs.EOF
%>
<a href="#anchor<% = rs("ResponseID") %>"><% = rs("Title") %></a><br />
<%
rs.MoveNext
Loop
%>

<p>&nbsp;</p>

<form name="qwerty">
<table>
<%
ResponseQuery = "SELECT * FROM TBL_RESPONSES WHERE ClientID = '" & ClientID & "' ORDER BY Title DESC"
'Response.Write(ResponseQuery) : Response.End
Set rs = Conn.Execute(ResponseQuery)

Do While NOT rs.EOF
%>
<tr>
<td><a name="anchor<% = rs("ResponseID") %>" /><h5><% = rs("Title") %></h5></td>
</tr>
<tr>
<td>
<div align="center"><textarea name="text<% = rs("ResponseID") %>" cols="38" rows="6" wrap="virtual"><% = rs("Message") %></textarea><br />
<input type="button" name="selectall<% = rs("ResponseID") %>" value="Select & Copy" onclick="document.qwerty.text<% = rs("ResponseID") %>.focus(); document.qwerty.text<% = rs("ResponseID") %>.select(); copytext()" /><br /><br /><a href="#top"><sup>TOP</sup></a></div>
</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<%
rs.MoveNext
Loop

Conn.Close
Set Conn = Nothing
%>
</table>
</form>

</body>
</html>

misti
09-11-2002, 06:26 PM
Thank you both for your assistance, I will give this a try today. I appreciate your time and assistance. Have a good day & God bless.
:)