Hi Guys :
i took this Fading Ticker Tape Script and basicly what i trying to do is replacing the Message and ID number with my database Id and Message Field column in my sql server .
now to the problem :
the problem is that my database start from 1 and the scrip from 0 and everytime that the script starts i get " undefined " Message befor i get the database content ( which means that something missing ), can you please help me with this java script how can i change it so that the script skip the missing Id numbers and i will not get the undefined message or missing parameters
thanks allot by advanced
Line that i changed :
news[<%=(announcements.Fields.Item("Mid").Value)%>]="<a href='<%=(announcements.Fields.Item("Link").Value)%>'><%=(announcements.Fields.Item("Msg").Value)%></a>"
Code:<%@LANGUAGE="VBSCRIPT"%> <!--#include file="Connections/store.asp" --> <% Dim announcements Dim announcements_numRows Set announcements = Server.CreateObject("ADODB.Recordset") announcements.ActiveConnection = MM_store_STRING announcements.Source = "SELECT * FROM dbo.announcements" announcements.CursorType = 0 announcements.CursorLocation = 2 announcements.LockType = 1 announcements.Open() announcements_numRows = 0 %> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=windows-1255"> <style type="text/css"> <!-- body { background-image: url(); background-color: #FFFFFF; } .alpha {font-family:tahoma;font-size:12px;color:#5B7299} .blue {font-family:tahoma;font-size:11px;color:#5D8EE1} .dblue {font-family:tahoma;font-size:10px;color:#5B7299} .inp1 {font-family:tahoma;font-size:11px;width:121px} .orange {font-family:tahoma;font-size:11px;color:#FF6B00} .txt {font-family:tahoma;font-size:11px;color:#8D9AAD} --> </style> <link href="css/Style.css" rel="stylesheet" type="text/css"> <link href="css/topmenu.css" rel="stylesheet" type="text/css"> <link href="css/Links.css" rel="stylesheet" type="text/css"> <style type="text/css"> <!-- #tickertape{ position:relative; layer-background-color:black; width:400px; height:20px; } #subtickertape{ background-color:black; position:absolute; border: 1px solid black; width:400px; height:20px; } .subtickertapefont{ font:bold 12px Verdana; text-decoration:none; color:white; } .subtickertapefont a{ color:white; text-decoration:none; } --> </style> </head> <body onload="if (ie||ns6||ns4) {regenerate2();updatecontent()}"> <!-- ImageReady Slices (FAQ.psd) --> <div id="tickertape"> <div id="subtickertape" class="subtickertapefont">Initializing...</div> </div> <script language="JavaScript1.2"> /*********************************************** * Fading Ticker Tape Script- © Dynamic Drive (www.dynamicdrive.com) * This notice must stay intact for use * Visit http://www.dynamicdrive.com/ for full source code ***********************************************/ //default speed is 4.5 seconds, Change that as desired var speed=4500 var news=new Array() news[<%=(announcements.Fields.Item("Mid").Value)%>]="<a href='<%=(announcements.Fields.Item("Link").Value)%>'><%=(announcements.Fields.Item("Msg").Value)%></a>" //news[1]="<a href='http://www.javascriptkit.com'>Visit JavaScript Kit for free JavaScripts!</a>" //news[2]="<a href='http://freewarejava.com'>Looking for free java applets? Click here.</a>" //expand or shorten this list of messages as desired var fadescheme=0 //set 0 to fade bgcolor from (white to black), 1 for (black to white) var hex=(fadescheme==0)? 255 : 0 var startcolor=(fadescheme==0)? "rgb(255,255,255)" : "rgb(0,0,0)" var endcolor=(fadescheme==0)? "rgb(0,0,0)" : "rgb(255,255,255)" var frame=20; var ie=document.all var ns6=document.getElementById var ns4=document.layers i=0 tickerobject=ie? subtickertape: ns6? document.getElementById("subtickertape") : document.tickertape.document function regenerate(){ window.location.reload() } function regenerate2(){ if (document.layers) setTimeout("window.onresize=regenerate",450) } function bgcolorfade() { // 20 frames fading process if(frame>0) { hex=(fadescheme==0)? hex-12 : hex+12 // increase or decrease color value depd on fadescheme tickerobject.style.backgroundColor="rgb("+hex+","+hex+","+hex+")"; // Set color value. frame--; setTimeout("bgcolorfade()",20); } else{ tickerobject.style.backgroundColor=endcolor; frame=20; hex=(fadescheme==0)? 255 : 0 } } function updatecontent(){ if (ie||ns6) bgcolorfade() if (ns4){ tickerobject.subtickertape.document.write('<span class="subtickertapefont">'+news[i]+'</span>') tickerobject.subtickertape.document.close() } else tickerobject.innerHTML=news[i] if (i<news.length-1) i++ else i=0 setTimeout("updatecontent()",speed) } </script> </body> </html> <% announcements.Close() Set announcements = Nothing %>



Reply With Quote

Bookmarks