Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-28-2007, 10:24 PM   PM User | #1
virgos69
New to the CF scene

 
Join Date: Dec 2007
Location: Maryland, USA
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
virgos69 is an unknown quantity at this point
JavaScript Newsticker Assistance

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 {
boxHeight=document.defaultView.getComputedStyle(document.getElementById('scrollBox'),"").getProperty Value("height")
boxHeight=eval(boxHeight.substring(0,boxHeight.indexOf("p")))
}
startScroller();
}

function startScroller() {
var scrollBox=document.getElementById('scrollBox');
scrollBox.style.visibility='visible';
scrollBox.style.top=viewHeight;
continueScrolling();
}

function continueScrolling() {
viewPos=(viewPos-viewMove);
scrollBox.style.top=viewPos+'px';
if(viewPos<0-boxHeight) { viewPos=viewHeight; }
setTimeout('continueScrolling()',viewSpeed);
}
</script>

<%
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
Conn.Open(csConnString)

dim sSQL

sSQL = "select * from [AAT Events]"
'response.write(sSQL)

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

'function nodo()

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

<tr>
<td colspan=4 align=center>
No records
</td>
</tr>

<%
else
'' 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
rs.moveNext

loop

end if

rs.close

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

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

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

%>

Thank you in advance for any help you may be able to give me with this.
virgos69 is offline   Reply With Quote
Old 12-29-2007, 12:20 AM   PM User | #2
A1ien51
Senior Coder

 
A1ien51's Avatar
 
Join Date: Jun 2002
Location: Between DC and Baltimore In a Cave
Posts: 2,717
Thanks: 1
Thanked 94 Times in 88 Posts
A1ien51 will become famous soon enough
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.

Eric
__________________
Tech Author [Ajax In Action, JavaScript: Visual Blueprint]
A1ien51 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:52 PM.


Advertisement
Log in to turn off these ads.