Solved

BookMark and QueryString

Posted on 2004-08-20
5
421 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

840 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