You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

13. April 2010, 16:51:45

Jaycom

Posts: 3

webticker_lib.js

Web Ticker not working in Opera
As the title says!!

I have a small site I am starting to develop, it has a news ticker running across the top that pulls the text from a SQL db table, in all browsers this works totally fine EXCEPT Opera, I have Opera 10 installed on my PC and N97 and neither show it, it will show on my iPhone running Safari though.

The code I am using is:

<DIV ID="TICKER" STYLE="display:none; border-top:1px solid #CCCCCC; border-bottom:1px solid #CCCCCC; overflow:hidden; background-color:#FFFFFF; width:720px" onmouseover="TICKER_PAUSED=true" onmouseout="TICKER_PAUSED=false">

<?php
$result = mysql_query("SELECT * FROM ticker");
while($newrow = mysql_fetch_row($result))
{
print('.']<span style="font-weight:bold; color: #000000; border-right: 1px solid #666666; padding: 0px 5px 0px 5px">'.$newrow[1].'</span>'); print('<span style="padding: 0px 5px; font-weight: normal;">'.$newrow[2].'</span>'); } ?> </DIV> and: <script type="text/javascript" src="webticker_lib.js" language="javascript"></script> Any Ideas ?

13. April 2010, 18:42:14

nowotny

Posts: 1296

Originally posted by Jaycom:

Any Ideas ?


And what we're suppose to do here...? my magic ball is broken... :/ either post webticker_lib.js or point us to a working page with an example...

Check the Error console...

13. April 2010, 18:51:54

Frenzie

Posts: 15541

It's probably also more useful to show your HTML output than your PHP code...
The DnD Sanctuary — a safety net for My Opera's demise.

15. April 2010, 10:32:46 (edited)

Jaycom

Posts: 3

the .js code is as follows:

// WebTicker by Mioplanet
// www.mioplanet.com

TICKER_CONTENT = document.getElementById("TICKER").innerHTML;

TICKER_RIGHTTOLEFT = false;
TICKER_SPEED = 2;
TICKER_STYLE = "font-family:Arial; font-size:12px; color:#444444";
TICKER_PAUSED = false;

ticker_start();

function ticker_start() {
var tickerSupported = false;
TICKER_WIDTH = document.getElementById("TICKER").style.width;
var img = "<img src=ticker_space.gif width="+TICKER_WIDTH+" height=0>";

// Firefox
if (navigator.userAgent.indexOf("Firefox")!=-1 || navigator.userAgent.indexOf("Safari")!=-1) {
document.getElementById("TICKER").innerHTML = "<TABLE cellspacing='0' cellpadding='0' width='100%'><TR><TD nowrap='nowrap'>"+img+"<SPAN style='"+TICKER_STYLE+"' ID='TICKER_BODY' width='100%'>&nbsp;</SPAN>"+img+"</TD></TR></TABLE>";
tickerSupported = true;
}
// IE
if (navigator.userAgent.indexOf("MSIE")!=-1 && navigator.userAgent.indexOf("Opera")=-1) {
document.getElementById("TICKER").innerHTML = "<DIV nowrap='nowrap' style='width:100%;'>"+img+"<SPAN style='"+TICKER_STYLE+"' ID='TICKER_BODY' width='100%'></SPAN>"+img+"</DIV>";
tickerSupported = true;
}
if(!tickerSupported) document.getElementById("TICKER").outerHTML = ""; else {
document.getElementById("TICKER").scrollLeft = TICKER_RIGHTTOLEFT ? document.getElementById("TICKER").scrollWidth - document.getElementById("TICKER").offsetWidth : 0;
document.getElementById("TICKER_BODY").innerHTML = TICKER_CONTENT;
document.getElementById("TICKER").style.display="block";
TICKER_tick();
}
}

function TICKER_tick() {
if(!TICKER_PAUSED) document.getElementById("TICKER").scrollLeft += TICKER_SPEED * (TICKER_RIGHTTOLEFT ? -1 : 1);
if(TICKER_RIGHTTOLEFT && document.getElementById("TICKER").scrollLeft <= 0) document.getElementById("TICKER").scrollLeft = document.getElementById("TICKER").scrollWidth - document.getElementById("TICKER").offsetWidth;
if(!TICKER_RIGHTTOLEFT && document.getElementById("TICKER").scrollLeft >= document.getElementById("TICKER").scrollWidth - document.getElementById("TICKER").offsetWidth) document.getElementById("TICKER").scrollLeft = 0;
window.setTimeout("TICKER_tick()", 30);
}

I don't really want to link the site right now for certain reasons I won't go into

Forums » General Opera topics » User JavaScript