Ticker dosn't work with Netscape and Mozilla

N

Nariak

Dear friends of programming!

the script below only works with MSI and Opera but not with Netscape 7.x and
Mozilla 1.x!

What is wrong?

Please help me!
Thanks Ralf

###########################################
....
<head>
<script language="javascript" type="text/javascript">
<!--
var delay=30;
var nextm=0;
var msg=new Array
(
'Ab sofort wieder täglich geöffnet! ',
'Montag bis Sonntag von 10 bis 23 Uhr ',
'JETZT MIT GROSSER TERASSE ! ! ! '
);

function start_ticker() {
do_ticker(msg[0], 0, 1);
}

function do_ticker(text, pos, dir) {
var out='<font face="Arial,Helvetica,MS Sans Serif"><strong><font
color="red" size=-1>'+text.substring(0, pos)+'</strong></font>';
if(navigator.appName=="Netscape")
with(document.ticker.document)
{
open(); write(out); close();
}
else
ticker.innerHTML=out;

pos+=dir;

if(pos>text.length)
setTimeout('do_ticker("'+text+'",'+pos+','+(-dir)+')', delay*1);
else
{
if(pos<0)
{
if(++nextm>=msg.length)
nextm=0;
text=msg[nextm];
dir=-dir;
}
setTimeout('do_ticker("'+text+'",'+pos+','+dir+')', delay*3);
}
}
//-->
</script>
</head>
<body onload="start_ticker()">
<table><tr><td align="center" valign="middle"><div
id="ticker"></div></td></tr></table>
</body>
</html>
 
M

McKirahan

Nariak said:
Dear friends of programming!

the script below only works with MSI and Opera but not with Netscape 7.x and
Mozilla 1.x!

What is wrong?

Please help me!
Thanks Ralf

###########################################
...
<head>
<script language="javascript" type="text/javascript">
<!--
var delay=30;
var nextm=0;
var msg=new Array
(
'Ab sofort wieder täglich geöffnet! ',
'Montag bis Sonntag von 10 bis 23 Uhr ',
'JETZT MIT GROSSER TERASSE ! ! ! '
);

function start_ticker() {
do_ticker(msg[0], 0, 1);
}

function do_ticker(text, pos, dir) {
var out='<font face="Arial,Helvetica,MS Sans Serif"><strong><font
color="red" size=-1>'+text.substring(0, pos)+'</strong></font>';
if(navigator.appName=="Netscape")
with(document.ticker.document)
{
open(); write(out); close();
}
else
ticker.innerHTML=out;

pos+=dir;

if(pos>text.length)
setTimeout('do_ticker("'+text+'",'+pos+','+(-dir)+')', delay*1);
else
{
if(pos<0)
{
if(++nextm>=msg.length)
nextm=0;
text=msg[nextm];
dir=-dir;
}
setTimeout('do_ticker("'+text+'",'+pos+','+dir+')', delay*3);
}
}
//-->
</script>
</head>
<body onload="start_ticker()">
<table><tr><td align="center" valign="middle"><div
id="ticker"></div></td></tr></table>
</body>
</html>

[snip]

Will this help?

http://www.permadi.com/tutorial/jsTypewriter/

Note: innerHTML is not part of W3C DOM standard and might be depreceated in
the future. An example of doing the same thing as above in W3C DOM is like
below:

document.getElementById("swappable").replaceChild(
document.createTextNode("Good evening"),
document.getElementById("swappable").childNodes[0]);

That piece of code will place the text "Good evening" as the first child
element of the DIV element. To include the html tags, such as <B>, you'll
need to create another node and make the text a child of that node.
Obviously, much more effort will be required.
 
N

Nariak

McKirahan said:
Nariak said:
Dear friends of programming!

the script below only works with MSI and Opera but not with Netscape 7.x and
Mozilla 1.x!

What is wrong?

Please help me!
Thanks Ralf

###########################################
...
<head>
<script language="javascript" type="text/javascript">
<!--
var delay=30;
var nextm=0;
var msg=new Array
(
'Ab sofort wieder täglich geöffnet! ',
'Montag bis Sonntag von 10 bis 23 Uhr ',
'JETZT MIT GROSSER TERASSE ! ! ! '
);

function start_ticker() {
do_ticker(msg[0], 0, 1);
}

function do_ticker(text, pos, dir) {
var out='<font face="Arial,Helvetica,MS Sans Serif"><strong><font
color="red" size=-1>'+text.substring(0, pos)+'</strong></font>';
if(navigator.appName=="Netscape")
with(document.ticker.document)
{
open(); write(out); close();
}
else
ticker.innerHTML=out;

pos+=dir;

if(pos>text.length)
setTimeout('do_ticker("'+text+'",'+pos+','+(-dir)+')', delay*1);
else
{
if(pos<0)
{
if(++nextm>=msg.length)
nextm=0;
text=msg[nextm];
dir=-dir;
}
setTimeout('do_ticker("'+text+'",'+pos+','+dir+')', delay*3);
}
}
//-->
</script>
</head>
<body onload="start_ticker()">
<table><tr><td align="center" valign="middle"><div
id="ticker"></div></td></tr></table>
</body>
</html>

[snip]

Will this help?
Not really! I don't know what you mean!
Nice Site!!! This stuff will help me!
Thanks!!!
Note: innerHTML is not part of W3C DOM standard and might be depreceated in
the future. An example of doing the same thing as above in W3C DOM is like
below:

document.getElementById("swappable").replaceChild(
document.createTextNode("Good evening"),
document.getElementById("swappable").childNodes[0]);

That piece of code will place the text "Good evening" as the first child
element of the DIV element. To include the html tags, such as <B>, you'll
need to create another node and make the text a child of that node.
Obviously, much more effort will be required.
 
Z

Zifud

McKirahan said:
Dear friends of programming!

the script below only works with MSI and Opera but not with Netscape 7.x
and

Mozilla 1.x!

What is wrong?

Please help me!
Thanks Ralf

###########################################
...
<head>
<script language="javascript" type="text/javascript">
<!--
var delay=30;
var nextm=0;
var msg=new Array
(
'Ab sofort wieder täglich geöffnet! ',
'Montag bis Sonntag von 10 bis 23 Uhr ',
'JETZT MIT GROSSER TERASSE ! ! ! '
);

function start_ticker() {
do_ticker(msg[0], 0, 1);
}

function do_ticker(text, pos, dir) {
var out='<font face="Arial,Helvetica,MS Sans Serif"><strong><font
color="red" size=-1>'+text.substring(0, pos)+'</strong></font>';
if(navigator.appName=="Netscape")
with(document.ticker.document)
{
open(); write(out); close();
}
else
ticker.innerHTML=out;

pos+=dir;

if(pos>text.length)
setTimeout('do_ticker("'+text+'",'+pos+','+(-dir)+')', delay*1);
else
{
if(pos<0)
{
if(++nextm>=msg.length)
nextm=0;
text=msg[nextm];
dir=-dir;
}
setTimeout('do_ticker("'+text+'",'+pos+','+dir+')', delay*3);
}
}
//-->
</script>
</head>
<body onload="start_ticker()">
<table><tr><td align="center" valign="middle"><div
id="ticker"></div></td></tr></table>
</body>
</html>

[snip]

Will this help?

http://www.permadi.com/tutorial/jsTypewriter/

Note: innerHTML is not part of W3C DOM standard and might be depreceated in

If it's not part of the standard, how can it be depreciated? :-o
the future. An example of doing the same thing as above in W3C DOM is like
below:

document.getElementById("swappable").replaceChild(
document.createTextNode("Good evening"),
document.getElementById("swappable").childNodes[0]);

Can also just change the text node's value:

<span id="z">blah</span>

<input type="button" value="Change the text" onclick="
document.getElementById('z').firstChild.data = 'new stuff';
">
<input type="button" value="Add some text" onclick="
document.getElementById('z').firstChild.data += 'more text';
">

Provided 'z' has a text node as the first child initially.
 
D

DU

Nariak said:
Dear friends of programming!

the script below only works with MSI and Opera but not with Netscape 7.x and
Mozilla 1.x!


Just want to add to Zifud excellent post. Mozilla as soon as revision
version 1.5 supports DOM 3 textContent attribute which is the exact
equivalent to MSIE's innerText.

Also, DevEdge used to have excellent articles on news tickers:

Cross-browser and web standard compliant Stock Ticker example
(http://devedge.netscape.com/toolbox/examples/2001/stock-ticker/)
for now, accessible at:
http://web.archive.org/web/20040202...scape.com/toolbox/examples/2001/stock-ticker/

Comprehensive W3C web standard compliant alternative to <marquee>
http://devedge.netscape.com/toolbox/examples/2002/xb/xbMarquee/
http://web.archive.org/web/20040202...scape.com/toolbox/examples/2002/xb/xbMarquee/

Note that ticker and DHTML marquee annoy users because they interfere
with peripherical vision, usually the user can not slow them down or
turn them off: so generally, they annoy users while taking, using
considerably a lot of user's system resources (cpu and RAM).

DU
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top