Solved

BookMark and QueryString

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Do you want to insert HTML5 video into your site? This is the tutorial how to do so. What are the main advantages of HTML5 video? 1) Have good compression, good image quality, and low decode processor use. 2) It is royalty-free 3) It is easi…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

758 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

22 Experts available now in Live!

Get 1:1 Help Now