View Full Version : Re-write Dom ticker JS to call content from external file?? Help!
sol07
06-30-2007, 11:02 PM
Hello
I want to use the domticker form Dyamic Drive that John has ammended:
http://www.dynamicdrive.com/forums/showthread.php?p=98469#post98469&postcount=7 (opens in new window)
It will be used on www.thesallyconnection.com
This script basically serves up news content with auto fade and manual controls. I have tested it in my page and it works great.
My question is:
How do I convert John's script to call the content from an external file?
I have tried to re-write the DOM and JS but to no avail
I want to place the content in an external file, say a text doc or html file that can be easily updated in one place.
Thanks in advance.
_Aerospace_Eng_
07-01-2007, 04:26 AM
You would need to use ajax to return the content from the external file. Personally I think this is a bit overkill. What I would do if you really wanted an external file is create a .js file with one variable. And assign the content to the variable or create an array and assign the content that way.
sol07
07-01-2007, 09:20 AM
You would need to use ajax to return the content from the external file. Personally I think this is a bit overkill. What I would do if you really wanted an external file is create a .js file with one variable. And assign the content to the variable or create an array and assign the content that way.
Hi thanks for your suggestion. Would you be able to help a little with writing that?
Here is where I am up to:
I have come across another good ticker script that does use Ajax, but it's not quite a dynamic (no manual controls) :
http://www.dynamicdrive.com/dynamicindex2/ajaxticker.htm (opens in new window)
"Wouldn't it be great to combine the two ticker scripts to create a really decent ticker!" I cheerfully thought to myself. Well, thinking is easy, is it not!
I have done my best, but to be honest, JS is something I'm a novice at best with. I seem to be missing something.
test page: www.thesallyconnection.com/index.html
I have put the following code in the head:
link to JS <script src="domticker.js" type="text/javascript"></script>
And in the body
<script type="text/javascript">
var xmlfile="tickercontent3.txt" //path to ticker txt file on your server.
var tickercontent=new Array()
new domticker(tickercontent, "domticker", "someclass", 10000, 1, "fadeit")
document.write("<br />")
</script>
And I have added #domticker to the main.CSS file.
Now, the var xmlfile="tickercontent3.txt" needs to be specified in the JS.
Can anyone hell with that? Or other suggestions?
Cheers
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.