Click to See Complete Forum and Search --> : load an external .js file


chris9902
08-07-2003, 05:46 AM
i want to load this from an external js file

<div id="tempholder"></div>
<script language="JavaScript" src="dhtmllib.js"></script>
<script language="JavaScript" src="scroller.js"></script>
<script language="JavaScript">

//SET SCROLLER APPEARANCE AND MESSAGES
var myScroller1 = new Scroller(0, 0, 170, 140, 1, 5); //(xpos, ypos, width, height, border, padding)
myScroller1.setColors("#000000", "#f4f4f4", "#f4f4f4"); //(fgcolor, bgcolor, bdcolor)
myScroller1.setFont("Verdana,Arial,Helvetica", 2);
myScroller1.addItem("<b>Headline</b><BR>this would be text 1");
myScroller1.addItem("<b>Headline</b><BR>this would be text 2");
myScroller1.addItem("<b>Headline</b><BR>this would be text 3");
myScroller1.addItem("<b>Headline</b><BR>this would be text 4");
myScroller1.addItem("<b>Headline</b><BR>this would be text 5");
//SET SCROLLER PAUSE
myScroller1.setPause(2500); //set pause beteen msgs, in milliseconds

function runmikescroll() {

var layer;
var mikex, mikey;

// Locate placeholder layer so we can use it to position the scrollers.

layer = getLayer("placeholder");
mikex = getPageLeft(layer);
mikey = getPageTop(layer);

// Create the first scroller and position it.

myScroller1.create();
myScroller1.hide();
myScroller1.moveTo(mikex, mikey);
myScroller1.setzIndex(100);
myScroller1.show();
}

window.onload=runmikescroll
</script>
<div id="placeholder" style="position:relative; width:170px; height:140px;"> </div>

David Harrison
08-07-2003, 12:02 PM
This is 100% untested, I'm just playing it from memory here. I think you can do this:

var new_js = document.createElement("script");
new_js.src="dhtmllib.js";

chris9902
08-07-2003, 12:28 PM
if i post the files can you post a HTML example on how to add that

David Harrison
08-08-2003, 01:25 PM
I'll give it a go, but could you try to strip away as much of the irrelevant code as possible.

chris9902
08-10-2003, 08:59 AM
i really don't no what is and is not important

if i post the .js file could you help me make it so it does this sort of thing :: http://forums.webdeveloper.com/showthread.php?s=&threadid=13917

chris9902
08-10-2003, 09:03 AM
if you look at the HTML file it is quite big but i want that script to be loaded like::


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


or something:(

David Harrison
08-10-2003, 02:44 PM
I'm pretty sure that this is what you mean but if it isn't then let me know:

chris9902
08-10-2003, 03:15 PM
that is so perfect.

you have REALLY helped me i am very greatful:D

thanks alot:D :D :D :D :D :D :D :D :D

David Harrison
08-10-2003, 03:45 PM
As always, I'm just happy to help. :)

chris9902
08-10-2003, 07:35 PM
and as always i will ask for help so you are happy:)