473,326 Members | 2,732 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Snap to top of page...

Hello,
I have not done much javascripting so this might be really easy. I have
a page that has anchors in it and I want to force that page to always
snap to the top instead of to the position when someone clicks on the
href to takethem to the anchor.

Thanks,
- Charles

May 6 '06 #1
4 1533


Rephase your Q, I don't follow.

Danny
May 7 '06 #2
ASM
he*****@llnl.gov a écrit :
Hello,
I have not done much javascripting so this might be really easy. I have
a page that has anchors in it and I want to force that page to always
snap to the top instead of to the position when someone clicks on the
href to takethem to the anchor.

<a href="#">top</a>

<a href="#anAnchor"
onclick="location='#';return false;">false anchor</a>

--
Stephane Moriaux et son [moins] vieux Mac
May 7 '06 #3
Thanks,
I did find what I was looking for. Since I don't know JS very well I
was not sure how to put it. Anyways, I added
onfocus="window.scrollTo(0,0);" to my body tag and everything is now
working.

- Charles

May 7 '06 #4
he*****@llnl.gov wrote:
I did find what I was looking for. Since I don't know JS very well I
was not sure how to put it. Anyways, I added
onfocus="window.scrollTo(0,0);" to my body tag and everything is now
working.


For suitable values of "to work".

- It will break with a runtime error (ReferenceError or TypeError) where
client-side scripting, but not this proprietary method, is supported.[1]

- It is not Valid markup, and will silently fail where this proprietary
attribute is not supported.[2]

- It will be an annoyance for the rest of the users.[3]

Why don't you go snowboarding instead?
PointedEars
___________
[1]
<URL:http://developer.mozilla.org/en/docs/DOM_Client_Object_Cross-Reference:window>
<URL:http://developer.mozilla.org/en/docs/DOM:window.scrollTo>

<URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/scrollto.asp>
[2] <URL:http://validator.w3.org/>
<URL:http://www.w3.org/TR/html4/index/attributes.html>
[3] <URL:http://codestyle.org.uk/javascript/FAQ.shtml#suppressctrln>
--
This above all: To thine own self be true.
-- William Shakespeare (1564-1616)
May 17 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Rhonda | last post by:
Using AccessXP I have lost snap to grid on my system. New or existing databases do not snap to grid for forms and reports in design view. Anyone have an idea on how to get it back?? Thanks. ...
3
by: Shrage H. Smilowitz | last post by:
Can someone guide me to what is involved to take a snap shot of a web page using .Net, i kow there is third party components that allows to do that, but i want to create my own. Shrage
2
by: SStory | last post by:
I have a picture that I allow the user to move around and would like to offer grid support like VB and other apps so that it will snap to the nearest point. How can I offer grid support so that...
6
by: Jim Hubbard | last post by:
Anybody seen an example of a snap-in GUI done in VB.Net?
1
by: Marc Gravell | last post by:
For a bespoke control, how can I implement my own designer snap lines in VS2005? I remember finding an MS article once, but I now can't re-locate it. Basically, I have a custom-control that...
1
by: Driez | last post by:
I recently installed .Net Framework 2.0 on my computer. I have developed a snap in c# using a library from sourceforge (http://sourceforge.net/projects/mmclibrary/) on Visual Studio 2003 When I...
0
by: Brian Henry | last post by:
Ok I've never implemented a snap location before so I dont really know what im doing wrong here... anyways, I am making a custom slider control that takes dates as its values instead of integers......
3
by: Chris | last post by:
I have a page that displays a datalist of multiple data items. In each dataitem I have gridviews that are pagable. It looks simular as I show below. I just want a way of hitting the gridview...
2
by: Razzbar | last post by:
I was wondering if anyone has experience with snap.com's service, where you put a reference to a remote script on your page. The script causes a small snapshot of a web page to appear wherever the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.