Hi,
I'm not a javascript pro or anything but....can you include/ import javascript files from within another javascript file?
including/ importing javascript files
Moderator: General Moderators
Re: including/ importing javascript files
Code: Select all
document.writeln('<script src="LOCATION_OF_OTHER_FILE" type="text/javascript"></script>');
Re: including/ importing javascript files
If you don't mind using a js framework, check out mootools' Assets function: http://docs.mootools.net/Remote/Assets.js
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
Re: including/ importing javascript files
I always recommend not using a framework by default as a large portion of people surfing the internet are still using dial-up most especially here in the US where broadband providers don't feel obligated to wire customers who don't live in residentially concentrated areas. For example as much as I love jQuery when it's even compressed it will require about 8-10 seconds to load alone (in addition to your own work/images/etc).
Re: including/ importing javascript files
8-10s?
so dial-up is 5KB/s? and jquery is 15KB, so it's 3 seconds and that is only the first time, javascript is loaded from cache on all the other requests
so dial-up is 5KB/s? and jquery is 15KB, so it's 3 seconds and that is only the first time, javascript is loaded from cache on all the other requests