简体   繁体   中英

Scroll text down after clicking

I am having difficulties in the following problem:

I have a screen in PHP which displays a list of some records when I choose any of these records (by clicking) it gives me a web site to share the data with this record. So far, it works.

I need to click on some of these records, instead of him open another page, scroll down the screen and the record data to appear in the same screen, ie without opening another window.

Do you have any idea how to do this?

Thanks

You'll need to have a DIV at the bottom of the page, which will be completed by using an Ajax call and some javascript or jquery.

Without going into too much detail, heres what needs to happen:

  1. User clicks a link which fires off an ajax request.
  2. The backend PHP script takes the ajax call and generates either XML or pure HTML and returns the data.
  3. JQuery or JavaScript on the original page takes the return and populates the empty DIV at the bottom of the page.

Regards

It sounds like you'll need to use ajax to pull this off.

I would personally suggest starting with reading up on the jQuery javascript library if you are not familiar with it already. It provides a very good set of ajax tools to work with.

Create a DIV layer on the bottom of the page. Use a simple AJAX library like this

Create a new php page that will only load a new record based on the recordID and call this page on the onclick method of your link that is now opening in the new window

I would try adding some jQuery to your page to handle this effect. If you do add jQuery here is a function written to do just that:

http://pastebin.com/SeMHwSgg

Call the script like so: Where a is the record you are having them click on and href="[some anchor]" located at the spot on the screen where you want the scrolling to stop:

<a id="gotop" href="#" onclick="goTop();return false;">click here</a>

So

Indeed, there is no error, it just does not have the effect that (scroll down the screen and show the record data). For now, it only shows the record open in another window.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM