Solved

BookMark and QueryString

Posted on 2004-08-20
5
415 Views
Last Modified: 2008-03-03
Say i have a URL

http://www.a.com/test.asp?ID=10&Day=Sun

How do I make it go to a bookmark with the same Querystring

for e.g.

1. http://www.a.com/test.asp#BookmarkName?ID=10&Day=Sun OR
2. http://www.a.com/test.asp?ID=10&Day=Sun#BookmarkName

either of the above does not work.
:) SD
0
Comment
Question by:sciber_dude
  • 4
5 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 11855478
both methods work for me on IIS.  What webserver are you using?
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 11855543
<HTML>
<HEAD>
<SCRIPT language="javascript">
 function querystring(name)   // returns a named value from the querystring
 {
   var tmp = ( location.search.substring(1) );
   var i   = tmp.toUpperCase().indexOf(name.toUpperCase()+"=");

   if ( i >= 0 )
   {
      tmp = tmp.substring( name.length+i+1 );
      i = tmp.indexOf("&");
      return unescape( tmp = tmp.substring( 0, (i>=0) ? i : tmp.length ));
   }

   return("");
 }
</SCRIPT>
</HEAD>

<BODY onload='location.replace("#"+querystring("anchor"));'>
<P><A href="#bottom" name="top">bottom</a>
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P>content
<P><A href="#top" name="bottom">top</a>
</BODY>
</HTML>
0
 
LVL 33

Accepted Solution

by:
knightEknight earned 125 total points
ID: 11855553
in the page above, you would do this:

 http://www.a.com/test.asp?ID=10&Day=Sun&anchor=BookmarkName

if you sub "bottom" for "BookmarkName" in the example above it will work
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 11855571
you can do this to verify:

<BODY onload='alert(querystring("Day"));location.replace("#"+querystring("anchor"));'>
0
 
LVL 11

Author Comment

by:sciber_dude
ID: 12044768
Thanks.

:) SD
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now