Hi Everyone
I have some javascript code on every page on my web site which is drawn into a certain part of my web site for an example page http://www.dor2dor.com/about-us.html its basically the testimonials part way down the right hand side. This automatically picks a random statement each time the page is refreshed or another page is selected.
Does anyone know how I can have this in a central place so that every time I need to add or remove something I don't have to change it on every page.
Any ideas would be greatly received.
If you are writing the code of that script into every page, and would like it to be 1 file that all pages reference instead, copy all of the info between that particular javascript's <script></script> tags in the <head> and paste it into a new javascript file in DW. Save the new .js file as "quote.js".
Change the <script> tags to this...
<script type="text/javascript" src="../pathtoyour/script/quote.js"></script>
Make sure the src path is to your new quote.js file.
That should do it.
Hi Jon
I have just tried it and its hinting a code error on line 28 of the javscript file. I have uploaded it here http://www.dor2dor.com/scripts/random-testimonials.js i have also tried it live but it doesn't work.
any help will be much appreciated.
North America
Europe, Middle East and Africa
Asia Pacific