You can take the following steps to implement the function.
1. Download the JQuery file from
here and the scrollTo.js plugin from
2.Copy the files jquery-1.4.1.js and jquery.scrollTo.js to the C:/Program Files/Common Files/Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS.
3. Open the page you want to edit with Microsoft Office Sharepoint Designer.
4. Add the following code to the page in body section. Sometimes you have to check the master file to see which ContentPlaceHolder control is placed in body. Then you can add the following code to relevant Content control.