PDA

View Full Version : I need help with the IFRAME scroller



losercoop
10-27-2006, 09:02 PM
1) Script Title: IFRAME scroller

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex2/iframe-scroller.htm
3) Describe problem: I am using the scroller a bit different than intended, but I need help with two things.

The first issue is, I need the scroller to start over at the bottom of the page (I added spaces to make it work, but I want the beginning to start right after the end without a space).

The second issue is I need it to pause on a timer as opposed to by page section or mouseover.

Does anyone have any ideas? I would really appreciate any help I can get.
The page I'm working on is at: http://65.77.232.5/elections/110706/scroll.asp

Thanks

doccmjmc
11-05-2006, 09:10 PM
would the pause up/down scoller script be of more use to you?

http://www.dynamicdrive.com/dynamicindex2/crosstick.htm

losercoop
11-15-2006, 09:14 PM
The problem with that script is that it pauses on page sections. I am using an css script that shows the results of a database so there are no page sections.
With that scroller script it would only pause above or below the script.

Here is the css script:


<STYLE type="text/css">
TD.Line {border-bottom:1 solid black; font-family:Verdana; font-size:10pt;}
</STYLE>
</HEAD>
<BODY bgcolor="#FFFFFF" link="#800000" vlink="#800000">
<div align="center">

&nbsp;
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</div>
<p align="center">
<b>
</span></b></p>
<div align="center">
<table border="0" width="80%">
<tr>
<td width="100%">

<p>
<p>
<p>

<% On Error GoTo 0
Const Filename = "s2-0.txt"
Const ForReading = 1, ForWriting = 2, ForAppending = 8

dim sRace, iNumCandidate, iWinningCandidate, iHighestNumber, iTotalVotes, filesys, filetxt, readfile, filepath, iQuote1, iQuote2, iSpace1, iSpace2, x

Dim CandidateArray()

'store the race name, precincts in and counter, total # of precincts voting
'store the candidate name, party (if any), number of votes
'store total votes for race

filepath = Server.MapPath(Filename)

Set filesys = CreateObject("Scripting.FileSystemObject")

If filesys.FileExists(filepath) Then%>
<% Set readfile = filesys.OpenTextFile(filepath, ForReading, False) 'dont create the file if it is not there

readfile.readline 'get past first two lines of the file
readfile.readline
Do Until readfile.AtEndOfStream
filetxt = readfile.readline%>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="10px" class="Line">&nbsp;</td>
<td colspan="3" class="Line">
<%iQuote1 = InStr(filetxt,"""") 'first quote of race name
iQuote1 = CInt(iQuote1+1) 'move past the first quote
iQuote2 = CInt(InStr(iQuote1,filetxt,"""")) 'ending quote of race name
sRace = Mid(filetxt,iQuote1, (iQuote2-iQuote1)) 'the race name

iNumCandidate = CInt(Mid(filetxt,(iQuote2+2),(InStr((iQuote2+2),filetxt," "))-(iQuote2+2))) 'get the number of candidates after the race title
ReDim CandidateArray((iNumCandidate-1), 1)

iSpace1 = InStrRev(filetxt," ") 'position of last space on line
iSpace2 = InStrRev(filetxt," ",(iSpace1-1)) 'position of second to last space on line
Response.write("<b>" & sRace & "</b>") 'write out the race title%>
</td>
</tr>
<tr>
<td width="10px" class="Line">&nbsp;</td>
<td class="Line" width="45%">
******
</td>
<td align="right" class="Line" width="25%">
<b>Votes</b>
</td>
<td align="right" class="Line" width="25%">
<b>% of votes counted</b>
</td>
</tr>
<%'Now work on writing out the candidates and their information
iHighestNumber = 0
iTotalVotes = 0
For x = 0 to (iNumCandidate-1)
filetxt = readfile.readline ' get next candidate
iQuote1 = InStr(filetxt,"""") 'first quote of Candidate name
iQuote1 = CInt(iQuote1+1) 'move past the first quote
iQuote2 = CInt(InStr(iQuote1,filetxt,"""")) 'ending quote of candidate name
while Mid(filetxt,iquote2-1,1) = "\"
iQuote2 = CInt(InStr(iQuote2+ 1,filetxt,""""))
wend
CandidateArray(x,0) = replace(Mid(filetxt,iQuote1, (iQuote2-iQuote1)),"\""","""") 'the candidate name
iQuote1 = InStr((iQuote2+1),filetxt,"""") 'first quote of Candidate party

iQuote2 = CInt(InStr((iQuote1+1),filetxt,"""")) 'ending quote of candidate party
If (iQuote2 <> (iQuote1+1)) Then 'party name found
CandidateArray(x,0) = CandidateArray(x,0) & " (" & Mid(filetxt,(iQuote1+1),(iQuote2-(iQuote1+1))) & ")"
End If
iSpace1 = InStrRev(filetxt," ") 'position of last space on line
CandidateArray(x,1) = CDbl(Mid(filetxt,(iSpace1+1))) ' Number of votes for Candidate
If (CandidateArray(x,1) > iHighestNumber) Then
iHighestNumber = CandidateArray(x,1) 'what is the hightest number of votes
End If
iTotalVotes = iTotalVotes + CandidateArray(x,1) 'number of total votes in this race
Next
For x = 0 to (iNumCandidate-1)
If (CandidateArray(x,1) = iHighestNumber) Then
Response.write("<tr style=""background-color:#FEFFB3;""><td width=""10px"" class=""Line"" style=""padding-right:5px;padding-left:2px;""><img src=""images/red.gif"" border=""0""></td>")
Response.write("<td class=""Line""><b>" & CandidateArray(x,0) & "</b></td><td align=""right"" class=""Line""><b>" & CandidateArray(x,1) & "</b></td><td align=""right"" class=""Line""><b>")
If (iTotalVotes = 0) Then
Response.write("0")
Else
Response.write(Round(((CandidateArray(x,1)/iTotalVotes)*100),2))
End If
Response.write("</b></td>")
Else
Response.write("<tr><td width=""10px"" class=""Line"" style=""padding-right:5px;padding-left:2px;""><img src=""images/green.gif"" border=""0""></td>")
Response.write("<td class=""Line"">" & CandidateArray(x,0) & "</td><td align=""right"" class=""Line"">" & CandidateArray(x,1) & "</td><td align=""right"" class=""Line"">")
If (iTotalVotes = 0) Then
Response.write("0")
Else
Response.write(Round(((CandidateArray(x,1)/iTotalVotes)*100),2))
End If
Response.write("</td>")
End If
Response.write("</tr>")
Next%>
<tr style="font-family:verdana;font-size:10pt;"><td width="10px">&nbsp;</td>
<td width="45%"><b>Totals:</b></td><td align="right" width="25%"><b><%=iTotalVotes%></b></td>
<td align="right" width="25%"><b>100%</b></td></tr>
</table><p></p>
<%Loop
readfile.close

Set readfile = nothing
Else%>
Please Refresh to get the Latest Results
<% End If

SET filesys = nothing%>

<br><br><p>&nbsp;</p>
<% If Err.Number <> 0 Then %>
<% =Err.Number%>
<% =Err.Clear%>
<% End If %>
</td>
</tr>
</table>

</div>
<center>