View Full Version : JavaScript Newsticker Assistance

12-28-2007, 11:24 PM
Greeting Everyone,

I am developing a web sight for a college club that wants a news ticker for their events an news from an Access Database. Using a combination of JavaScript and ASP, I came up with a design that pleased the club.

The design works on the localhost on my PC, but when I put it on the server, it started giving errors of "object required", dropped the content in the page that called the main design through a server side include, and does not display the content in the ticker.

I call the main design through an include that is supposed to display the content of the page in its 7th div. The page is to load the design, the scrolling text from the database (using some SQL code), and then load the content page.

The code for the scrolling ticker seems to be the problem. The server they use is a Microsoft Server 2005 owned by the college. I have contacted the administrator, but did not get any assistance with the issues.

Perhaps someone here can help me find the problem that would cause the program not to work on their server, when it works on the localhost on my PC. At this point, I am ready to trash the scrolling ticker and start fresh.

The following is the code for the ticker:

<script language="javascript">
var scrollBox = document.getElementById('scrollBox');
var viewHeight = 240;
var viewPos = viewHeight;
var viewSpeed = 40;
var viewPixels = 1;
var viewMove = viewPixels;

function out() { viewMove=viewPixels; }
function over() { viewMove=0; }

function divHeight() {
// find the height of the div called 'scrollBox'
var boxHeight = 0;
if(scrollBox.offsetHeight) {
boxHeight = scrollBox.offsetHeight;
} else {

function startScroller() {
var scrollBox=document.getElementById('scrollBox');

function continueScrolling() {
if(viewPos<0-boxHeight) { viewPos=viewHeight; }

function WriteEventItem(sDate, sTime, sName, sDesc)

<h5><%= sDate %> - <%= sTime %></h5>
<p align="left"><%= sName %><br />
<%= sDesc %></p>

end function
function WriteNewsItem(sDate, sLinktext, sLink)

<h5><%= sDate %></h5>
<p align="left"><a href=<%= sLink %> target="_blank"><%= sLinktext %></a></p>

end function


''Steps to get db data in asp
''Create db connection (require connection string)
''Create RecordSet
''Run query to populate the recordset

''connection and recordset variables
dim Conn, RS

set Conn = server.createobject("ADODB.Connection")
set RS = server.createobject("ADODB.Recordset")

''get connection string from http://connectionstrings.com

dim sSQL

sSQL = "select * from [AAT Events]"

''specify sql string and connection
rs.open sSQL, Conn

'function nodo()

if rs.eof and rs.bof then
'' if both true then no records

<td colspan=4 align=center>
No records

'' if there are records

do until rs.eof

WriteEventItem rs("Event Date"), rs("Event Time"), rs("Event Name"), rs("Event Location")

''Move to next record


end if


sSQL = "select * from [AATRecentNews]"
rs.open sSQL, Conn

if rs.eof and rs.bof then
'do nothing no news
'loop through news items and print
do until rs.eof
WriteNewsItem rs("NewsDate"), rs("HeadLine"), rs("StoryLink")
end if

''close rs and conn when done to relase memory
'end function


Thank you in advance for any help you may be able to give me with this.

12-29-2007, 01:20 AM
View the page source and look at what is different. Install firebig [http://www.getFirebug.com] for Firefox and it will give you a better explaination on the error.