Page Jump

admin

Administrator
Staff member
This is sort of an HTML/ASP question.<br />
<br />
In the tutorial I read that in order to have a page jump I need to use the following code : <A HREF=http://www.webdeveloper.com/forum/archive/index.php/"#Codeword">.<br />
<br />
And where I want it to go I use this code:<br />
<A NAME="Codeword">.<br />
<br />
Let's say the page I'm using this code on is called products.asp. The issue I'm having is that I pass a quesrystring to the products.asp page. So when I get to the products.asp page the link ends up looking like this....<br />
<br />
<!-- w --><a class="postlink" href="http://www.companyname.com/product.asp?type=1#Codeword">www.companyname.com/product.asp?type=1#Codeword</a><!-- w --> <br />
<br />
I think that becasue of the querystring the page jump doesn't work. <br />
<br />
How can I get around this?<!--content-->Hi Ninel...<br />
<br />
Can you define "jump"?<br />
<br />
Are you trying to have the user go to a specific anchor in the page?<br />
<br />
If so, it's:<br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"jumpto.htm?#bottom">click</a><br />
<br />
and the "jumpto.htm" page would contain an anchor like this:<br />
<a name="bottom"><br />
<br />
Is that what you are talking about?<br />
k<!--content-->You need to use the full link of your page. ie. <a href=http://www.webdeveloper.com/forum/archive/index.php/"product.asp#Codeword"><!--content-->huh?<!--content-->Basically, the same thing you said (posted at the same time). They will need to include the name of the page in their <a href> instead of just putting the #anchorname...<!--content-->I included the name, but because it reads the querystring there is an error if I don't include the ?type=2 part.<br />
<br />
But if I do include it then the page doesn't jump.<!--content-->I've never tried this, but it would be interesting to know if it works... Would it work to code your link with that anchor first, and then the query string? try <a href=http://www.webdeveloper.com/forum/archive/index.php/"product.asp#Codeword?type=2"> and let me know if it works.<!--content-->A variable that I'm trying to read becomes empty when I try to jump.<br />
<br />
Is the form submitting when the page jumps?<!--content-->oh... right.<br />
<br />
hey... sorry Ninel... you started this using an ASP example and then I bastardized it.<br />
<br />
there is nothing wrong with this:<br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"product.asp?Type=1#bottom">click</a><br />
<br />
...and if this is in product.asp it will display the name/value:<br />
<a name="bottom"><% =Request.QueryString%><br />
(as "Type=1")<br />
<br />
As far as using the term "jump", I believe that some people use that word to refer to "calling" a sub or function (i'm not sure, since I'm self-taught and use the term "call")<br />
<br />
What is it your trying to do?<br />
Can you post more code maybe?<br />
k<!--content-->oh!<br />
I see that you say FORM!<br />
(I missed that earlier).<br />
<br />
Sorta the same, but different.<br />
passedVar = request.form(Type)<br />
(no querystring variables necessary)<br />
where passedVar will = 1<br />
<br />
Post your code.<br />
(and this really belongs in the ASP forum).<br />
k<!--content-->shoot!<br />
am i confusing the crap out of you?<br />
For the querystring method:<br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"product.asp?Type=1#Codeword"><br />
(not "bottom". that was my example).<br />
<br />
Plus, to submit the form (instead of the querystring method), just use<br />
<form action="product.asp#Codeword" method=post><br />
and retrieve the form's values using<br />
request.form(formElementName) <br />
(this also maintains your "jump" to the "Codeword" anchor - but you can ommit it).<br />
<br />
Also... while it seems to work ok (in a stripped-down test page), I would shy away from using the name "Type ", since I believe that it is a reserved word, and it may come back to bite you in the ass sometime later (although I would like to here from someone who knows if that is true or not).<br />
<br />
But really Ninel.....<br />
code!. need some code.<br />
k<!--content-->Let me first explain the layout of my page:<br />
<br />
At the top of the page:<br />
iProdTypeId = Request.QueryString("type")<br />
<br />
Then I use the variable to execute a query on an Access database:<br />
<br />
Set rsEquipData = Server.CreateObject("ADODB.Recordset")<br />
sSQL = "SELECT pn.ProdTypeId, pn.ProdId, pn.ProdName, pn.ProdDesc, pn.ProdPic FROM prodNames pn WHERE pn.ProdTypeId=" & iProdTypeId<br />
rsEquipData.Open sSQL, cnConn<br />
<br />
Then I want to see the link that jumps:<br />
<br />
If iProdTypeId =2 Then <br />
Dim a<br />
a = "<p><A HREF='http://www.webdeveloper.com/forum/archive/index.php/product.asp#Jump?type=" & <br />
iProdTypeId & "'>Pre-owned and ReConditioned" <br />
a = a & "</A> </p>"<br />
Response.Write a<br />
End If<br />
<br />
And this is where I want the page to jump when the link is clicked:<br />
<A NAME="jump"><%=sHTML%> (sHTML is a variable that contains the html)<br />
<br />
Now the first time the page loads everything works properly.<br />
When I click on the link to jump I believe the page submits and starts reading from the top.<br />
My variable iProdTypeId is empty and when I try to execute the SQL statement I get ODBC error.<br />
<br />
Why isn't it reading the ?type=1 querystring the 2nd time?<br />
<br />
I hope all of this made sense.<!--content-->Why isn't it reading the ?type=1 querystring the 2nd time? It appears to me that for the 2nd time to be run at all, "type" has to <br />
be equal to 2, not 1, in order for the IF statement to even execute. <br />
<br />
If "type" is equal to 1 (or any other value than 2), your IF statement <br />
has no conditional alternative (it ends without executing anything).<br />
<br />
Also, it must read as follows:<br />
<br />
if iProdTypeID = 2 then<br />
Dim a<br />
a= "<p><a href='http://www.webdeveloper.com/forum/archive/index.php/product.asp?type=" & iProdTypeID & "#jump'>Pre-owned and ReConditioned"<br />
a=a & "</a></p>"<br />
response.write a<br />
end if<br />
(you have the anchor in the wrong place)<br />
<br />
But once again, that will only execute if "type" is equal to 2.<br />
(do you have multiple if/then statements that you did not show <br />
here in your example?)<br />
<br />
Try that first.<br />
Then let me know if you are still having problems and I'll see if I <br />
can try to understand your use of links ("jumps"). I'm having difficulty <br />
understanding the logic of using them as you do, but there are always <br />
many ways of doing things, so I'm willing to try to understand what you <br />
are trying to accomplish here.<br />
Let me know...<br />
k<!--content-->khaki, <br />
<br />
Thank you so much for all your help. It finally worked.<br />
<br />
Ninel<!--content-->C :) :) L !<!--content-->
 
Back
Top