I am tied to using a CMS that doesn't allow me to edit within the head tags but has a single preconfigured file that I can put any Javascript.
The site I am currently building will have a couple of different instances where Javascript will be needed.
For example, it will have a script controlling a drop down menu, and a script (making use of Jquery) that controls a tootip.
So, making use of one external .js file, how do you suggest I call different scripts for different tasks, and I will also need to call the Jquery library.
I would rather avoid including any js within the body tags.
If you are not able to edit between the head tags you will need to include script tags in the body. There is no other way to do it given your restrictions.
You could try something like this which does work. You may have to create and attach more than one script element in the function, and be sure not to overwrite any existing onload handler.
so would I put the given script into the one javascript area that I have been allowed access too and the other .js files into the same directory as that file?
so would I put the given script into the one javascript area that I have been allowed access too and the other .js files into the same directory as that file?
cheers
yes, in the same folder when using just file names.
you can also specify full urls (http:// to .js), they don't even have to be on your site...
And do I need to call that function from within script tags in the body? Would I need to put the following? Also, does it matter where I put this in the body?
<script type="text/javascript">
<!--
onload = function ()
// -->
</script>
sorry, thanks for you patience and help, I'm fairly new to this JS game as you can tell...
Bookmarks