Click to See Complete Forum and Search --> : external file for div menu with 2 JS scripts attached?


brettv72
08-21-2006, 03:06 PM
MOVED TO JAVASCRIPT FORUM

Hi there. I am a total noob when it comes to HTML and JavaScript. I've created a website using a menu that floats down the page as I scroll and also has clickable menu headings which open the menu's subheadings. By including everything inline on each page, it all works fine.

My problem is that I want the menu in an external file so that when I make changes to it I only need to do so once, not on every page. I can't figure out how to get the menu itself into an external file, as it is within the <div> tags, and still get the scripts attached to it to work. The scripts are split into different sections of the page, some parts in the head, others in the body.

This is happening in all browsers, as well as the preview of FrontPage, which I am using to create the site. I tried putting the javascripts in external files with links to them within the pages (a la <script type="text/javascript" script src="myfile.js"></script>) but kept getting errors.

The site itself (in working form) is at:
Oxy Online Writing Lab (http://departments.oxy.edu/cae/OWL/index.html)

I'm attaching the source code in a .doc file. I've highlighted those parts of my code that are relevant to my problem, but am including the entire code because I don't know what anyone helping me does or does not need to see. Sorry it's so long.

This is really driving me crazy! If anyone can help, I would really appreciate it.
Thanks.

MOVED TO JAVASCRIPT FORUM

Mr Initial Man
08-21-2006, 03:12 PM
I tried putting the javascripts in external files with links to them within the pages (a la <script type="text/javascript" script src="myfile.js"></script>) but kept getting errors.

Hmmm... I think I see an error in your start tag:

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

The underlined, bold part shouldn't be there. This is proper:

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

I do hope that helps. By the way, this should be in the Javascript forum, I do believe.