I'm working for a company right now that has hundreds of pages that use a javascript to load a left sidebar. I didn't create the original, but have to work within its framework. I;m fairly new to Java, want to insert a new image slideshow (from http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm) into the this sidebar. Unfortunately, I need to load 3 other javascript files in this one, as well as create a div with the javascript for my slideshow to go in. I spent 6 hours on it today, trying multiple solutions I've found on this site and others, couldn't get it to work.
Is this possible?
I need to load "javaA.js", "javaB.js", & "javaC.js" from this script, which runs on over 500 pages. Part 2 is having a div created, but just this first part would help heaps.
Thanks in advance for help.
Solution Found:
Here's the code that ended up working for me:
function loadjscssfile(filename, filetype){
if (filetype=="js"){ //if filename is a external JavaScript file
var fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript")
fileref.setAttribute("src", filename)
if (typeof fileref!="undefined")
document.getElementsByTagName("head")[0].appendChild(fileref)
}
loadjscssfile("http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js", "js")
loadjscssfile("JavaA.js", "js")
loadjscssfile("JavaB.js", "js")