473,837 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Snap to top of page...

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.

- Charles

May 6 '06 #1
4 1563

Rephase your Q, I don't follow.

May 7 '06 #2
he*****@llnl.go v a écrit :
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="locati on='#';return false;">false anchor</a>

Stephane Moriaux et son [moins] vieux Mac
May 7 '06 #3
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

- Charles

May 7 '06 #4
he*****@llnl.go v 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

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?
<URL:http://developer.mozil la.org/en/docs/DOM_Client_Obje ct_Cross-Reference:windo w>
<URL:http://developer.mozil la.org/en/docs/DOM:window.scro llTo>

<URL:http://msdn.microsoft. com/workshop/author/dhtml/reference/methods/scrollto.asp>
[2] <URL:http://validator.w3.or g/>
<URL:http://www.w3.org/TR/html4/index/attributes.html >
[3] <URL:http://codestyle.org.u k/javascript/FAQ.shtml#suppr essctrln>
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

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. Rhonda
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
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 the image will snap in place on grid points like a commerical app? I am not sure how to implement that. Anyone have any code? Thanks,
by: Jim Hubbard | last post by:
Anybody seen an example of a snap-in GUI done in VB.Net?
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 comprises e.g. a TextBox and some other things; I don't want to do anything too clever - I just want to forward the snap-lines on my control to inherit those from the TextBox, mainly for the "bottom of the text" snap line (for want of a better term) -...
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 run my MMC project in debug mode from Visual Studio 2003 the mmc starts up but crahes immediately. An hourglass appears and then the MMC crashes. I have set up my project settings to start the program mmc.exe with a command line argument of...
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... then taking that date range and finding dates specifiec between them (in a list of dates) and putting snap marks, so if you slide it near one of them it should snap to that tick, but that part i cant figure out. the rest seems ok so far... here...
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 paging number on an item not to cause the page to snap back to the top of the page. Rather I would want it to stay exactly where it's at. Is there something I can put in the code behind (C#) in pageload that will say snap back to where I was? ...
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 user mouses over a link on your page. This is very simple to implement on a static page -- paste in one line of code. But what about when you have a dynamic page with content pulled in by AJAX requests? On a static page, the script is loaded...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.