login  Naam:   Wachtwoord: 
Registreer je!
 Forum

Nieuwsscroller/ticker, tekst uit extern bestand mogelijk?

Offline allegro - 22/03/2005 14:00
Avatar van allegroNieuw lid Hoi,

Ik vond op http://www.webs...&id=40 een script dat past bij mijn wens om een nieuwsscroller op de index pagina te hebben.

Het enige wat ik minder vind (op de lengte van het script na), is dat de gewenste tekst in het script zelf staan..
Daardoor is het lastiger te updaten of de opmaak aan te passen..

Is het mogelijk die tekst te vervangen door een extern bestand dat aangeroepen wordt? html, txt wat dan ook?

Of is er een script wat hetzelfde doet, dus tekst van onder naar boven laten bewegen, 4 sec. laten staan, volgende tekst?
Als het een korter script is, is het nog beter natuurlijk.

Groet,

Allegro

4 antwoorden

Gesponsorde links
Offline numlockrond - 22/03/2005 15:25
Avatar van numlockrond Onbekend adkfasjfpajfapdfkasdfoaisdjiajfiawdiofjioqwfiowjfioasiopiofjkljkadajjkljklasdjklasdjkljklasjklfasdjkjklasasassadajjkkjjklasdfjkasdjkfaskjdfajsjkasdf;;;ljjkl;;asdf.
Offline nemesiskoen - 22/03/2005 15:34 (laatste wijziging 22/03/2005 15:34)
Avatar van nemesiskoen Gouden medaille

PHP expert
http://sitemast...amp;cat=13

ik begrijp u reactie numlockrond...
Offline prorsoft - 22/03/2005 16:06 (laatste wijziging 22/03/2005 16:24)
Avatar van prorsoft PHP gevorderde nemesiskoen, dit staat in de categorie JavaScript hoor, dan heeft hij er niet veel aan als je met PHP scripts aan komt dragen.^^
http://www.site...amp;cat=45

uit een bestand is zeer simpel
je doet gewoon een script includen
<script src="nieuws.js" />
en in dat nieuws.js staat dan:

nieuws[]="Bericht1";
nieuws[]="Bericht2";
nieuws[]="Bericht3";
nieuws[]="Bericht4";
Offline Dekin - 22/03/2005 19:19
Avatar van Dekin Nieuw lid Dit is een scrolltekstfader
In de head kun je de snelheden en pixels enz aanpassen.
Zet dit in de head
  1. <script language="JavaScript1.2">
  2.  
  3. //1)Boodschappen invullen :
  4. var TS_message = new Array();
  5. TS_message[0] = '<div align="center">Op zoek naar leuke javascripts ?</div>';
  6. TS_message[1] = '<div align="center">Je vindt ze op deze site.</div>';
  7. TS_message[2] = '<div align="center">http:\/\/users.skynet.be/javascript.</div>';
  8. <!-- je kunt zoveel boodschappen toevoegen als je wil -->
  9.  
  10. //2) Scrollbreedte en kleuren
  11. var TS_scrollwidth=600 //breedte scrollbox
  12. var TS_colorFG = 0xFF0000; //tekstkleur
  13. var TS_colorBG = 0xFFCC66; //achtergrondkleur
  14.  
  15. var TS_ymax = 50; //aantal pixels te bewegen
  16. var TS_ystep = -1; //1 of -1 : scrollrichting
  17. var TS_speed = 10; //scrollsnelheid : vlugger = kleinere waarde invullen
  18. var TS_pause = 1000; //pauze tussen de berichten in milliseconden
  19. var TS_fadestep= 100; //aantal stappen voor fade-in/fade-out
  20.  
  21. if (document.all)
  22. document.write('<style>#containerarea{width:'+TS_scrollwidth+'}</style>')
  23. </script>

Zet dit in de body
  1. <DIV id="containerarea">
  2. <SCRIPT LANGUAGE="JavaScript1.2" SRC="scrollfader.js"></SCRIPT>
  3. </DIV>


En dit is een 3D tekst banner. Als je dit script doorleest vind je vanzelf waar je de snelheid aan kan passen. En eventueel links kan invoegen.
Zet dit in de head
  1. </head>
  2. <xml:namespace ns="urn:schemas-microsoft-com:vml" prefix="v"/>
  3. <style>v\:* {behavior:url(#default#VML);}</style>

Zet dit in de body
  1. <body>
  2. <!-- Breedte en hoogte tabel moeten gelijk zijn aan breedte en hoogte van de tekst. -->
  3. <table width=700 height=60 border=0 cellpadding=0 cellspacing=0>
  4. <tr><td align="center">
  5. <script language="JavaScript" type="text/javascript">
  6. var text=new Array()
  7. var textlink=new Array()
  8. var texttarget=new Array()
  9.  
  10. <!--De teksten -->
  11.  
  12. text[0]="Allegro"
  13. text[1]="Is dit wat je zoekt??"
  14. text[2]="Of niet??"
  15. text[3]="Er staat ook boven de objecten"
  16. text[4]="Om het maar zo te noemen"
  17. text[5]="wat het is en wat het doet"
  18.  
  19. <!-- Eventuele links -->
  20.  
  21. textlink[0]="#"
  22. textlink[1]="#"
  23. textlink[2]="#"
  24. textlink[3]="#"
  25. textlink[4]="#"
  26. textlink[5]="#"
  27.  
  28. <!-- Targetnaam bij frames -->
  29.  
  30. texttarget[0]="_self"
  31. texttarget[1]="_self"
  32. texttarget[2]="_self"
  33. texttarget[3]="_self"
  34. texttarget[4]="_self"
  35. texttarget[5]="_self"
  36.  
  37. var textfont="Arial Black" // lettertype
  38. var textfontcolor=new Array("#FF0000","#0000FF","#00FF00","#660000") // tekstkleuren
  39. var outlinecolor=new Array("#000000","#000000","#FDCF15","#996600") // tekstrandkleuren
  40. var shadowcolor=new Array("#FFFF00","#00FFFF","#FDCF15","#3300FF") // tekstschaduwkleuren
  41. var textfontcolorrollover="#ff0000" // tekst rollover-kleur
  42. var textfontsize=10 // tekstgrootte
  43. var textbgcolor="#FFFF00" // tekstachtergrondkleur
  44. var textweight="normal" // 'bold' of 'normal'
  45. var textitalic="normal" // 'italic' of 'normal'
  46.  
  47. var textwidth=700 // identiek aan tabelbreedte!
  48. var textheight=60 // identiek aan tabelhoogte!
  49.  
  50. var textpause=4 // pauze in seconden
  51.  
  52. var tekstdoosborder=3 // randdikte
  53. var tekstdoosbordercolor="#996600" // randkleur
  54. var widthfontoutline=1 // dikte letterrand
  55. var fontopacity="50%" // transparantie tekst
  56. var shadowopacity="50%" // transparantie schaduw
  57. var applygradient=true // 'true' of 'false'
  58. var i_shape=4 // waarden 0-3,4 = alle vormen
  59.  
  60. // *********************Hieronder niets wijzigen***************************
  61.  
  62. var path=new Array()
  63. path[0]="m20 0c300 140,300 50,580, 0m20 300c400 100,300 250,580 300e"
  64. path[1]="m20 100c300 -50,300 50,580, 100m20 200c300 400,300 300,580 200e"
  65. path[2]="m20 120c300 100,300 50,580, 0m20 180c300 180,300 300,580 300e"
  66. path[3]="m20 0c300 140,300 50,580, 0m150 300c400 100,300 250,450 300e"
  67.  
  68. var i_path=0
  69. var speed=60
  70. var textdecoration="none"
  71.  
  72. var innerwidth=Math.floor(0.90*textwidth)
  73. var innerheight=Math.floor(0.90*textheight)
  74.  
  75. var posleft=Math.floor((textwidth-innerwidth)/2-tekstdoosborder)
  76. var postop=Math.floor((textheight-innerheight)/2)
  77.  
  78. var i_message=0
  79. var i_messagelength=0
  80. var i_outlinecolor=0
  81. var i_textfontcolor=0
  82. var i_shadowcolor=0
  83.  
  84. var textalign="center"
  85. var textvalign="middle"
  86. var textitalicA=""
  87. var textitalicB=""
  88. var textweightA=""
  89. var textweightB=""
  90. var textfontsizeHTML=1
  91. var i_mes=0
  92.  
  93. var i_substring=0
  94. var i_presubstring=0
  95. var i_text=0
  96. var textcontent=""
  97. var notag=true
  98. var textpresubstring=""
  99. var textaftersubstring=""
  100. textpause*=1000
  101.  
  102. var browserinfos=navigator.userAgent
  103. var ie4=!document.getElementById&&document.all&&!browserinfos.match(/Opera/)
  104. var ie5=document.getElementById&&document.all&&!browserinfos.match(/Opera/)
  105. var ns6=document.getElementById&&!document.all&&!browserinfos.match(/Opera/)
  106. var opera=browserinfos.match(/Opera/)
  107.  
  108. function gettextcontent() {
  109. tablewidth=textwidth-2*tekstdoosborder
  110. tableheight=textheight-2*tekstdoosborder
  111. textpresubstring=text[i_text].substring(0,i_presubstring)
  112. var i_prepre=i_presubstring-1
  113. if (i_prepre<0) {i_prepre=0}
  114. if (text[i_text].substring(i_prepre,i_presubstring)=="<"){notag=false}
  115. if (text[i_text].substring(i_prepre,i_presubstring)==">"){notag=true}
  116. if (notag) {
  117. textcontent="<table border=0 cellpadding=4 width="+tablewidth+" height="+tableheight+"><tr valign="+textvalign+"><td align="+textalign+">"
  118. textcontent+="<a href='"+textlink[i_text]+"' target='"+texttarget[i_text]+"' style='position:relative; font-family:"+textfont+";text-decoration:"+textdecoration+";font-family:"+textfont+";color:"+textfontcolor[i_textfontcolor]+";font-size:"+textfontsize+"pt;font-weight:"+textweight+";font-style:"+textitalic+"' onMouseOver=\"this.style.color=\'"+textfontcolorrollover+"\'\" onMouseOut=\"this.style.color=\'"+textfontcolor[i_textfontcolor]+"\'\">"
  119. textcontent+=textpresubstring
  120. textcontent+="</a>"
  121. textcontent+="</td></tr></table>"
  122. }
  123. }
  124.  
  125. function showtickerNS6() {
  126. textcontent="<table border=0 cellpadding=4 width="+textwidth+" height="+textheight+"><tr valign="+textvalign+"><td align="+textalign+">"
  127. textcontent+="<a href='"+textlink[i_text]+"' target='"+texttarget[i_text]+"' style='position:relative; font-family:"+textfont+";text-decoration:"+textdecoration+";font-family:"+textfont+";color:"+textfontcolor[i_textfontcolor]+";font-size:"+textfontsize+"pt;font-weight:"+textweight+";font-style:"+textitalic+"' onMouseOver=\"this.style.color=\'"+textfontcolorrollover+"\'\" onMouseOut=\"this.style.color=\'"+textfontcolor[i_textfontcolor]+"\'\">"
  128. textcontent+=text[i_text]
  129. textcontent+="</a>"
  130. textcontent+="</td></tr></table>"
  131. document.getElementById("ticker").innerHTML=textcontent
  132. i_text++
  133. i_textfontcolor++
  134. if (i_text>=text.length) {i_text=0}
  135. if (i_textfontcolor>=textfontcolor.length-1) {i_textfontcolor=0}
  136. var timer=setTimeout("showtickerNS6()", textpause)
  137. }
  138.  
  139. function showticker() {
  140. if (i_substring<=text[i_text].length) {
  141. i_substring++
  142. i_presubstring=i_substring-1
  143. if (i_presubstring<0) {i_presubstring=0}
  144. gettextcontent()
  145. if (opera) {
  146. document.getElementById("ticker").innerHTML=textcontent
  147. var timer=setTimeout("showticker()", speed)
  148. }
  149. }
  150. else {
  151. clearTimeout(timer)
  152. var timer=setTimeout("changetext()", textpause)
  153. }
  154. }
  155.  
  156. function changetext() {
  157. i_substring=0
  158. i_presubstring=0
  159. i_text++
  160. i_textfontcolor++
  161. i_path++
  162. if (i_text>text.length-1) {i_text=0}
  163. if (i_textfontcolor>textfontcolor.length-1) {i_textfontcolor=0}
  164. showticker()
  165. }
  166.  
  167. function changeform() {
  168. if (i_outlinecolor >= outlinecolor.length) {i_outlinecolor=0}
  169. if (i_textfontcolor >= textfontcolor.length) {i_textfontcolor=0}
  170. if (i_shadowcolor >= shadowcolor.length) {i_shadowcolor=0}
  171. if (i_path>path.length-1) {i_path=0}
  172. document.getElementById('strokeid').color=outlinecolor[i_outlinecolor]
  173. document.getElementById('fillid').color=textfontcolor[i_textfontcolor]
  174. document.getElementById('shadowid').color=shadowcolor[i_shadowcolor]
  175. if (i_shape==path.length) {
  176. document.getElementById('shapeid').path=path[i_path]
  177. }
  178. if (i_message < text.length) {
  179. tick()
  180. }
  181. else {i_message=0;tick()}
  182. }
  183.  
  184. function tick() {
  185. if (i_messagelength <= text[i_message].length) {
  186.  
  187. var messagestringend=""
  188. var messagestring=text[i_message].substring(0, i_messagelength)+messagestringend
  189. document.getElementById('textpathid').string=messagestring
  190. var timer=setTimeout("tick()",speed)
  191. i_messagelength++
  192. }
  193. else {
  194. clearTimeout(timer)
  195. var timer=setTimeout("prechangeform()",textpause)
  196. }
  197. }
  198.  
  199. function prechangeform() {
  200. i_messagelength=0
  201. i_message++
  202. i_outlinecolor++
  203. i_textfontcolor++
  204. i_shadowcolor++
  205. i_path++
  206. changeform()
  207. }
  208.  
  209. function openlink() {
  210. if (texttarget[i_message]=="_blank") {
  211. codepopup=window.open(textlink[i_message], "code", "status=yes,location=yes,toolbar=yes,menubar=yes,resizable=yes,scrollbars=yes,width=770,height=460,top=10,left=10");
  212. }
  213. else if (texttarget[i_message]=="_top") {
  214. top.location.href=textlink[i_text]
  215. }
  216. else if (texttarget[i_message]=="_parent") {
  217. parent.location.href=textlink[i_text]
  218. }
  219. else if (texttarget[i_message]=="_self") {
  220. document.location.href=textlink[i_text]
  221. }
  222. else {
  223. var jumpto=eval("parent."+texttarget[i_text])
  224. jumpto.location.href=textlink[i_text]
  225. }
  226. }
  227.  
  228. if (ie5) {
  229. document.write('<div ID="roof" style="position:relative;width:'+textwidth+'px;height:'+textheight+'px;border-style:solid;border-width:'+tekstdoosborder+'px;border-color:'+tekstdoosbordercolor+';background-color:'+textbgcolor+';cursor:hand" onClick="openlink()">')
  230. document.write('<v:shapetype id="shapeid" coordsize="600,320" path="'+path[i_shape]+'">')
  231. document.write('<v:path textpathok="t"/>')
  232. document.write('<v:textpath on="t" fitshape="t" xscale="t"/>')
  233. document.write('</v:shapetype>')
  234. document.write('<v:shape type="#shapeid" style="position:absolute; top:3px; left:'+posleft+'px; width:'+innerwidth+'px;height:'+innerheight+'px;" strokeweight="1pt">')
  235. if (applygradient) {
  236. document.write('<v:fill id="fillid" method="linear sigma" type="gradient" color="'+textfontcolor[i_textfontcolor]+'" opacity="'+fontopacity+'"/>')
  237. }
  238. else {
  239. document.write('<v:fill id="fillid" color="'+textfontcolor[i_textfontcolor]+'" opacity="'+fontopacity+'"/>')
  240. }
  241. document.write('<v:stroke id="strokeid" weight="'+widthfontoutline+'pt" color="'+outlinecolor[i_outlinecolor]+'"/>')
  242.  
  243. document.write('<v:shadow on="t" id="shadowid" opacity="'+shadowopacity+'" color="'+shadowcolor[i_shadowcolor]+'"/>')
  244. document.write('<v:textpath id="textpathid" style="font-family:\''+textfont+'\';v-text-kern:t" trim="t" fitpath="t" xscale="f" string="Hello World"/>')
  245.  
  246. document.write('</v:shape>')
  247. document.write('</div>')
  248. }
  249.  
  250.  
  251. if (ns6 || opera) {
  252. if (ns6) {
  253. textwidth-=2*tekstdoosborder
  254. textheight-=2*tekstdoosborder
  255. }
  256. document.write('<div ID="roof" style="position:relative;width:'+textwidth+'px;height:'+textheight+'px;border-style:solid;border-width:'+tekstdoosborder+'px;border-color:'+tekstdoosbordercolor+';background-color:'+textbgcolor+'">')
  257. document.write('<span ID="ticker" style="position:absolute;top:0px;left:0px;width:'+innerwidth+'px;height:'+innerheight+'px;"></span>')
  258. document.write('</div>')
  259. }
  260.  
  261. if (ie5) {window.onload=changeform}
  262. if (opera) {window.onload=showticker}
  263. if (ns6) {window.onload=showtickerNS6}
  264. </script>
  265. </td></tr></table>
Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.229s