C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !






Top-Down scrolling Window in Javascript


Posted Date: 23 Jul 2008    Resource Type: Code Snippets    Category: Javascript

Posted By: shariff       Member Level: Silver
Rating:     Points: 8



Simply insert the below code sample anywhere inside the <body> section of a web page you wish to scroll. Variable "speed" determines the speed at which scrolling is done. (Change 1 to another number as desired.)


<script language="JavaScript">


//change 1 to another integer to alter the scroll speed. Greater is faster
var speed=1
var currentpos=0,alt=1,curpos1=0,curpos2=-1
function initialize()
{
startit()
}

function iecompattest()
{
return (document.compatMode!="BackCompat")? document.documentElement : document.body
}

function scrollwindow()
{
if (document.all)
temp=iecompattest().scrollTop
else
temp=window.pageYOffset
if (alt==0)
alt=1
else
alt=0
if (alt==0)
curpos1=temp
else
curpos2=temp
if (curpos1!=curpos2){
if (document.all)
currentpos=iecompattest().scrollTop+speed
else
currentpos=window.pageYOffset+speed
window.scroll(0,currentpos)
}
else
{
currentpos=0
window.scroll(0,currentpos)
}
}
function startit(){
setInterval("scrollwindow()",10)
}
window.onload=initialize
</script>





Responses

Author: Nirupa Rani Acharya    27 Jul 2008Member Level: Bronze   Points : 0
thanks 4 dis coding...


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Top-Down scrolling with Javascript  .  Top-Down scrolling window script  .  Top-Down Scrolling  .  Scrolling a Web Page  .  Javascript function for Top-Down scrolling  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Swapping Images using javascript
Previous Resource: Word and Character Counter
Return to Discussion Resource Index
Post New Resource
Category: Javascript


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

doors in nj

Contact Us    Privacy Policy    Terms Of Use