Hey there! any question in your mind? Ask It Now!.

Popular Categories





Java Script: onClick a button window scrolldown

+2 votes
134 views
asked in Programming by mHelpMe (670 points)
I want a button on web page in which when user click on that button window should scroll down, How can we do it with simple java script?

Thanks For Answering !

1 Answer

+2 votes
answered by amit_pammu Expert (5,030 points)
selected by mHelpMe
 
Best answer
<!DOCTYPE html>
<html>
<body>
 
<p>it might be helpful for you!.</p>
 
 
<button onclick="scrollWin(0,100)" style="position:fixed;">Scroll down</button><br><br>
 
 
<div style="border:1px solid black;background-color:lightblue;height:7500px;width:5000px;">
</div>
 
<script>
function scrollWin(x,y)
{
window.scrollBy(x,y);
}
</script>
 
</body>
</html>
 
commented by mHelpMe (670 points)
Wow Thanks amit_pammu its working ...Could you explain the code here how its happening actually i am new in programming.
commented by amit_pammu Expert (5,030 points)
basically , its just a javascript predefined window property,,scrollBy...
and you have to just give the dimensions .
like..the above code!!!.

Related Questions

+6 votes
1 answer 1,628 views
+5 votes
2 answers 1,149 views
+3 votes
1 answer 33 views
+1 vote
1 answer 126 views
asked in Programming by amit_pammu Expert (5,030 points)
+3 votes
1 answer 2,173 views
+1 vote
1 answer 145 views
+1 vote
1 answer 734 views
+5 votes
1 answer 1,167 views

Not a Member yet?

Ask to Folks Login

My Account
1058 Folks are online
69 members and 989 guest online
Your feedback is highly appreciated