homepage Welcome to WebmasterWorld Guest from 54.227.21.95
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
how to handle repeated javascript code in many html files
so that it can be changed later easily
lalit

5+ Year Member



 
Msg#: 3981788 posted 7:34 am on Sep 1, 2009 (gmt 0)

I am going to use several html pages, and there is a javascript code that is being repeated on every page. how can i make it possible that the code may be changed any time easily (just by changing it in one common file).
The code which is being repeated is also javascript code.

 

Alternative Future

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3981788 posted 12:29 pm on Sep 1, 2009 (gmt 0)

Hi lalit

Here is a post that might help explain what you are looking to do... [webmasterworld.com...]

HTH

-Gs

lalit

5+ Year Member



 
Msg#: 3981788 posted 11:15 am on Sep 3, 2009 (gmt 0)

thanx it works.

can you tell me the way if the code is html code instead of jsp should i use document.write or there is better way.

Fotiman

WebmasterWorld Senior Member fotiman us a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



 
Msg#: 3981788 posted 1:52 am on Sep 4, 2009 (gmt 0)

To include JavaScript in many HTML pages, you don't need document.write. Simply include the JavaScript file from each page, as in:

<script type="text/javascript" src="yourjsfile.js"></script>

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved