PDA

View Full Version : Moving javascript code


firejdl
07-17-2003, 06:26 PM
Hello:

I would like to move some javascript code [specifically Dynamic Drive's Fading Scroller - http://www.dynamicdrive.com/dynamicindex2/fadescroll.htm] either offpage, in a .js [or whatever] file, or move it to another portion of the page, for search engine optimization purposes. I tried moving the script to a linked file, but, since it generates content on the page, that didn't work. Moving the code to another section on the page also moves the text.

The only other way I could think of, was to tell the script to make the text appear in a certain box by naming the td cell. However, I don't know much about Javascript [and we don't have a Javascript book where I work yet], so I don't know how this would be accomplished.

Would it be possible like this? Is there any other [better?] way to do this?

You can see the pages I'm trying to move the javascript on at this link: http://www.5starps.com/.

[And yes, I just noticed that the table is resizing itself with the fader...]

Any help would be appreciated. Thanks in advance.

~ Joey

P.S. I posted this here rather than in the Dynamic Drive section, because this could apply to any Javascript that creates body content.

RoyW
07-17-2003, 08:47 PM
Take a look at this (http://www.javascript-fx.com/newstickers/vertical/demo1.html) script. The code for the scroller and the text for the news are all in external files plus you can have images in your "news text" and they also fade.

All you have to do is put

<SCRIPT>
document.write(myScroller.toHtml(200,80));
</SCRIPT>

where you want the scroller to appear.

The download and instructions can be found here (http://www.javascript-fx.com/newstickers/index.html).

firejdl
07-18-2003, 04:13 PM
Thanks, but after that script didn't work, I figured out how to get the Dynamicdrive script working on my own. I just needed to create a div with the correct id [which was set in the script itself].