javascript - HTML multiple onclick events not occurring when I want -


when user clicks read more, want page change new page (news.html) , scroll down specific amount lines article, what's happening when click read more, page lowers specific amount , changes top of news.html page

<article>      <h3>is joe hart right torino?</h3>      <img src = "news_images/joe_hart_torino.jpg" alt = "joe" width="225" height="150">      <button class = "btn btn-block btn-primary" onclick ="change(); scrollwin();">            <p>read</p>      </button>              </article>  <script>     function change(){         document.location.href = "news.html";     } </script> <script>     function scrollwin() {         window.scrollby(100, 175);     } </script> 

you can use fragment instance #content. put in appropriate place on news.html page , update function like

function change(){     document.location.href = "news.html#content"; } 

btw when click 1 onclick event occurs it's not supposed occur multiple events , in case both functions executed, moving takes time , see scrolling first. using scroll hardcoded value not idea, you'll need update every time update content of news.html

**update** 

procrastinator right, see comment below, use anchor if it's applicable you.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -