PDA

View Full Version : Switch Content - Can It Be An External JS???



matt blank
04-25-2006, 10:14 AM
Hi guys,

I'm currently using the Switch Content script whereby you can collapse and expand text on the page.

http://www.dynamicdrive.com/dynamicindex17/switchcontent.htm

I think it's brill, however the javascript you need to put in the HEAD of the document is quite long. I've tried to place it in an external JS file and then link it, but for some reason this stopped the script on the page from working.

Is it possible to do this? Can anyone help me please? As it makes the code really long oterhwise when trying to alter anything on the page.

Thanks!
Matt Blank

Twey
04-25-2006, 03:06 PM
It should be possible to do. Make sure you've included the external file properly, and make sure there is only Javascript in the external file -- HTML tags (such as <script></script>) and HTML comment delimiters (<!-- -->) are not allowed.
If this doesn't help, please give us the URI to your page.

matt blank
04-25-2006, 06:36 PM
Ahhh thanks! I had the <script> tags left in...didn't realise they should come out! Works great now.

Many thanks for your help!
Matt