Hi, I have this pre-built JS routine that creates a text animation
special-effect. The routine was included inside a freeware HTML editor,
called AceHTML. The problem is that it seems to work only on IE and
IE-emulating browsers (such as Opera). According to what other people have
told me, the problem is because this script has an outdated browser
detection scheme, and that the procedure it uses for Netscape is no longer
valid in modern Netscapes/Mozillas, etc. Now, I'm no JS expert, I just
started doing HTML a couple of weeks ago to put up a personal page, so I
wasn't expecting to get involved in the bowels of JS programming and
debugging until much later when I'd become more advanced.
Specifically, the JSconsole error messages on Firefox shows that any lines
that start with "document.wds.document.write(...)" as being undefined.
If you want to see what this script looks like when it's working, then go to
this site, and look at the animated heading for this page (but use IE or a
compatible):
http://ca.geocities.com/bbbl67/mower4sale.html
I need to know how to make this thing work on any W3C-compliant browser. I
understand that even the IE portion of the script is outdated and irrelevant
to modern IE, but it still maintains backwards compatibility with it.
Yousuf Khan
I've pasted the script from the above mentioned page down below:
----------
<script language="JavaScript">
<!-- Begin
// Original: Charles Foster (wc*****@msn.com)
// Web Site: http://kylo.ml.org/flash
// This script and many more are available free online at
// The JavaScript Source!! http://javascript.internet.com
var speed = 100;
var cycledelay = 2000;
var maxsize = 28;
var x = 0;
var y = 0;
var themessage, size;
var esize = "</font>";
function initArray() {
this.length = initArray.arguments.length;
for (var i = 0; i < this.length; i++) {
this[i] = initArray.arguments[i];
}
}
var themessage2 = new initArray(
"SOLD!",
"Thanks for your interest"
);
if(navigator.appName == "Netscape")
document.write('<layer id="wds"></layer><br>');
if (navigator.appVersion.indexOf("MSIE") != -1)
document.write('<span id="wds"></span><br>');
function upwords(){
themessage = themessage2[y];
if (x < maxsize) {
x++;
setTimeout("upwords()",speed);
}
else setTimeout("downwords()",cycledelay);
if(navigator.appName == "Netscape") {
size = "<font point-size='"+x+"pt'>";
document.wds.document.write(size+"<center>"+themes sage+"</center>"+esize);
document.wds.document.close();
}
if (navigator.appVersion.indexOf("MSIE") != -1){
wds.innerHTML = "<center>"+themessage+"</center>";
wds.style.fontSize=x+'px';
}
}
function downwords(){
if (x > 1) {
x--;
setTimeout("downwords()",speed);
}
else {
setTimeout("upwords()",cycledelay);
y++;
if (y > themessage2.length - 1) y = 0;
}
if(navigator.appName == "Netscape") {
size = "<font point-size='"+x+"pt'>";
document.wds.document.write(size+"<center>"+themes sage+"</center>"+esize);
document.wds.document.close();
}
if (navigator.appVersion.indexOf("MSIE") != -1){
wds.innerHTML = "<center>"+themessage+"</center>";
wds.style.fontSize=x+'px';
}
}
setTimeout("upwords()",speed);
// End -->
</script>
--
Humans: contact me at ykhan at rogers dot com
Spambots: just reply to this email address ;-)