Topics
Mind Fresher Games
Books Deals
Hot Questions
Hot Answers
New Questions
Ask a Question
Explore
Ask a Question
Programming
Java Script: onClick a button window scrolldown
Java Script: onClick a button window scrolldown
+2
votes
633
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 !
closed
javascript
onclick
click
1
Answer
+2
votes
answered
by
amit_pammu
Expert
(
5.1k
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>
0
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.
0
commented
by
amit_pammu
Expert
(
5.1k
points)
basically , its just a javascript predefined window property,,scrollBy...
and you have to just give the dimensions .
like..the above code!!!.
Your comment on this answer:
Use comments to reply to other users or notify them of changes. If you are adding new information, edit your post instead of commenting.
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Not a Member yet?
My Account
525
Folks are online
8
members and
517
guest online
Related questions
onClick current date and time in java script
onClick a button redirect to a URL in JAVASCRIPT
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting T_STRING
print dynamic value by java script
Personal email validation script.
JavaScript- Open a new tab while focusing on an old tab
How to check a String contains another sub string using JavaScript
How to create a jQuery price Range slider ?
How to center a paragraph of text on a particular word in HTML, CSS, or JavaScript?
how to send email in PDF format on submit a button
How to create and delete a window service from CMD?
how to get all child nodes in JSON
Reason behind why body returns false?
How to store current context to local variable using JavaScript
click event of li in JQuery using Jstree.
how to set cookies in JavaScript
JavaScript: Select and Delect all check box on click one check box
I want to return the response from AJAX call?
I want to append to an array in Javascript is it possible?
How to click on an element in selenium web driver?
Categories
All categories
Software Testing
(48)
Programming
(130)
Interview Questions
(28)
My Career
(1)
Puzzles
(4)
Motor Bikes
(11)
Travel
(9)
Electronics
(1)
Entertainment
(2)
OTHER
(18)
Recent
Popular Questions
Registration and login form in PHP?
Tell me best places to visit during holi in india?
What is the best time to visit and the best way to get to the Taj Mahal?
JavaScript- Open a new tab while focusing on an old tab
What should I know before visiting Jim Corbett National Park?
Tell me best places to visit during holi in india?
What is the best time to visit and the best way to get to the Taj Mahal?
What should I know before visiting Jim Corbett National Park?
How to download COVID vaccination certificate and correct personal details?
How to book Vaccine slot quickly ?
All categories
Software Testing
(48)
Programming
(130)
Interview Questions
(28)
My Career
(1)
Puzzles
(4)
Motor Bikes
(11)
Travel
(9)
Electronics
(1)
Entertainment
(2)
OTHER
(18)
Your feedback is highly appreciated