Click to See Complete Forum and Search --> : Dynamice page editing
sinch
07-16-2008, 04:08 PM
Hi,
I have the following problem.
I have build-up a site and divided it into div's (menu, sidebar and content). What I want is to change only "content" div when I click on the link from the menu, NOT to reload the whole page, as document.write function does....
Is it possible?I have inserted a deezer.com player on the sidebar so when I click on the links music reloads...
Thanks,
sinch
donatello
07-16-2008, 05:59 PM
Yes with pagination or Ajax.
There are a bunch of pagination scripts over at Dynamic Drive.
You can use my JavaScript Search (http://www.javascriptsearch.org/results.html?cx=016703912148653225111%3A2snawkdvrjq&cof=FORID%3A9&q=pagination&sa=Search#949) to find pagination scripts.
You might want to look into Ajax Tabs, this is how Yahoo does its home page. Very cool, and trendy too. :)
Have fun.
seatoskyhk
07-16-2008, 06:36 PM
it is absolutely possible. that's how facebook works too.
step to setup:
1) name ur <div>, e.g. <div id="mycontent">
2) set up event on menu (or any element) (e.g. onKeyUp=checkAndSubmit() )
3) Client side: call aJax functions (do a little reading to udnerstand the behaviour first)
4) Server Side: Set up server side script as the calling function. ( php, python, C++, cgi.. whatever can print output)
5) Client side: set up a callback function which put the response (or return) text to the <div>
6) * Data you get back can be in anykind of text format. you can have plain text, xml, json, html, whatever text. You just have to write the callback function to take the data properly.
It will be a headache in the beginnig,but once you start using it, you will love it.
Suggestion: go to w3schools and look at the ajax lesson. however, the sample functions there is a simple version, you may need to search or write ur own code to serve ur purpose. but hte basic is the same.
aside:
donatello, your javascriptsearch.org is neat! I've just contributed to your daily visit. :D
donatello
07-17-2008, 02:10 AM
aside:
donatello, your javascriptsearch.org is neat! I've just contributed to your daily visit. :D
Thanks! Glad you like it!
Anyway, here's a pagination script in action. I passed this to a friend of mine who used it on his parody site to annoy vegetarians (http://www.vegetariansareevil.com).
Follow THIS (http://www.vegetariansareevil.com/thanksgiving.html) LINK to see the pagination script in action... the story is broken up into four parts, and you paginate at the bottom of each section to the next page.
He got the script from Dynamic Drive:
/***********************************************
* Virtual Pagination script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/