Page 1 of 1
including/ importing javascript files
Posted: Mon May 12, 2008 4:47 am
by kendall
Hi,
I'm not a javascript pro or anything but....can you include/ import javascript files from within another javascript file?
Re: including/ importing javascript files
Posted: Mon May 12, 2008 12:26 pm
by arjan.top
Re: including/ importing javascript files
Posted: Mon May 12, 2008 5:09 pm
by LSJason
Code: Select all
document.writeln('<script src="LOCATION_OF_OTHER_FILE" type="text/javascript"></script>');
That may or may not work, depending on the rest of the code.
Re: including/ importing javascript files
Posted: Sun May 18, 2008 3:13 pm
by HCBen
If you don't mind using a js framework, check out mootools' Assets function:
http://docs.mootools.net/Remote/Assets.js
Re: including/ importing javascript files
Posted: Mon May 19, 2008 7:00 pm
by JAB Creations
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
Posted: Tue May 20, 2008 1:50 am
by arjan.top
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