Skip navigation
NessaFrankling
Currently Being Moderated

javascript converting

Aug 28, 2012 10:37 AM

Tags: #help #error #adobe #jquery #cs5.5 #dreamweaver #javascript #code #html5 #javahelp #javascript_writing

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.

 
Replies
  • Currently Being Moderated
    Aug 28, 2012 10:51 AM   in reply to NessaFrankling

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 29, 2012 2:50 AM   in reply to NessaFrankling

    I haven't looked at the whole script, but an external JavaScript file should not contain <script type="text/javascript"> at the beginning or </script> at the end. It should contain only JavaScript.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points