472,988 Members | 3,512 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,988 software developers and data experts.

debugging an old script

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 ;-)

Jul 23 '05 #1
13 1514
On Thu, 26 Aug 2004 18:05:59 GMT, Yousuf Khan <bb****@ezrs.com> wrote:

[snip]
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.


If I may be frank, abandon it. It would be much simpler to create an
animated GIF that displayed the same thing. Adding, "Sold! Thanks for your
interest.", to the alt attribute of such an image would also make your
page much more accessible. An animated GIF would also not cause the page
dimensions to constantly change.

To make the script, another example of the "high" quality of The
JavaScript Source's collection, workable in a wide range of browsers would
require it to be re-written from scratch. Considering the alternative, I
don't honestly think it's worth the effort.

[snip]

Sorry,
Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #2
Michael Winter wrote:
If I may be frank, abandon it. It would be much simpler to create an
animated GIF that displayed the same thing. Adding, "Sold! Thanks for
your interest.", to the alt attribute of such an image would also
make your page much more accessible. An animated GIF would also not
cause the page dimensions to constantly change.
Actually, I kind of liked that effect. Made it look like a heartbeat or a
balloon.
To make the script, another example of the "high" quality of The
JavaScript Source's collection, workable in a wide range of browsers
would require it to be re-written from scratch. Considering the
alternative, I don't honestly think it's worth the effort.


I'll take it with advisement.

Yousuf Khan
Jul 23 '05 #3
On Fri, 27 Aug 2004 18:53:57 GMT, Yousuf Khan <bb****@ezrs.com> wrote:
Michael Winter wrote:
If I may be frank, abandon it. It would be much simpler to create an
animated GIF that displayed the same thing. Adding, "Sold! Thanks for
your interest.", to the alt attribute of such an image would also
make your page much more accessible. An animated GIF would also not
cause the page dimensions to constantly change.


Actually, I kind of liked that effect. Made it look like a heartbeat or a
balloon.


You missed the point. You can get the same effect, just with an animated
image rather than playing around with the font size. An image will be more
accessible (provided that you use the alt attribute), and it's guaranteed
to work almost in every graphical browser[1]. The same cannot be said for
that script, or any other like it.

[snip]

Mike
[1] "Almost" because some open-source graphical browsers do not implement
GIF loading properly because of the patent held on the GIF compression
algorithm.

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #4
"Yousuf Khan" <bb****@ezrs.com> wrote in message news:<bE*******************@news01.bloor.is.net.ca ble.rogers.com>...
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:


That's a very old script and, apologies to the author, not a very good
visual effect.

Try this one: - seems to be hidden from Opera though.
----------------------------------------|
<script type="text/javascript">

if ((document.getElementById) &&
window.addEventListener || window.attachEvent){

var win = window.toString(); //No Opera!
if (win != "[object Object]" ){

(function(){

//Configure here.

var message = "your message here";
var col = new Array('#ff0000','#00aa00','#0000ff'); //add more.
var xyz = 26; //max grow size.
var spd = 40; //setTimeout speed.

//End.

var msg = message.split(" ");
var timer = null;
var clrPos = 0;
var msgPos = 0;
var jog = 1;
var currentStep = 10;
var step = 8;
var h,w,y,x,r,xy;
var d = document;
var pix = "px";
var domWw = (typeof window.innerWidth == "number");
var domSy = (typeof window.pageYOffset == "number");
var running = true;
var box,txt;
var ovrflw = (d.documentElement.style &&
typeof d.documentElement.style.MozOpacity == "string")
?"-moz-scrollbars-none":"hidden";
var idx = d.getElementsByTagName('div').length;

d.write("<div id='_box"+idx+"' style='position:absolute;top:0px;"
+"left:0px;height:10px;width:10px;text-align:center;"
+"overflow:"+ovrflw+"'>"

+"<div id='_txt"+idx+"' style='position:absolute;top:0px;left:0px;"
+"width:1px;height:1px;font-family:arial,sans-serif;font-size:1px'>."
+"<\/div><\/div>");

if (domWw) r = window;
else{
if (d.documentElement &&
typeof d.documentElement.clientWidth == "number" &&
d.documentElement.clientWidth != 0)
r = d.documentElement;
else{
if (d.body &&
typeof d.body.clientWidth == "number")
r = d.body;
}
}

function winsize(){
var oh,sy,ow,sx,rh,rw;
if (domWw){
if (d.documentElement && d.defaultView &&
typeof d.defaultView.scrollMaxY == "number"){
oh = d.documentElement.offsetHeight;
sy = d.defaultView.scrollMaxY;
ow = d.documentElement.offsetWidth;
sx = d.defaultView.scrollMaxX;
rh = oh-sy;
rw = ow-sx;
}
else{
rh = r.innerHeight;
rw = r.innerWidth;
}
h = rh;
w = rw;
}
else{
h = r.clientHeight;
w = r.clientWidth;
}
y = Math.floor(h/2);
x = Math.floor(w/2);

xy = (w >= h)?w:h;
}

function scrl(yx){
var sy,sx;
if (domSy){
sy = r.pageYOffset;
sx = r.pageXOffset;
}
else{
sy = r.scrollTop;
sx = r.scrollLeft;
}
return (yx == 0)?sy:sx;
}

function dsply(){
step += 15;
currentStep += step;

txt.top = y + Math.floor(-currentStep/16) + pix;
txt.left = x + Math.floor(-currentStep/2) + pix;
txt.width = currentStep + pix;
txt.fontSize = Math.floor(currentStep/8) + pix;
txt.color = col[clrPos];
d.getElementById("_txt"+idx).firstChild.data = msg[msgPos];
if (currentStep > xy * xyz){
currentStep = 10;
step = 8;
msgPos += jog;
clrPos += jog;
}
if (clrPos >= col.length){
clrPos = 0;
}
timer = setTimeout(dsply,spd);
if (msgPos >= msg.length){
running = false;
box.width = 1 + pix;
box.height = 1 + pix;
box.visibility = "hidden";
txt.width = 1 + pix;
txt.height = 1 + pix;
txt.visibility = "hidden";
clearTimeout(timer);
}
box.top = scrl(0) + pix;
box.left = scrl(1) + pix;
}
function dims(){
if (domWw) box.width = "100%";
else box.width = w + pix;
box.height = h + pix;
}
function init(){
winsize();
box = document.getElementById("_box"+idx).style;
txt = document.getElementById("_txt"+idx).style;
dims();
dsply();
}

function rsz(){
if (running){
winsize();
dims();
}
}
if (window.addEventListener){
window.addEventListener("resize",rsz,false);
window.addEventListener("load",init,false);
}
else if (window.attachEvent){
window.attachEvent("onresize",rsz);
window.attachEvent("onload",init);
}

})();
}
}//End.
</script>
Jul 23 '05 #5
victor ebuwa wrote:
That's a very old script and, apologies to the author, not a very good
visual effect.

Try this one: - seems to be hidden from Opera though.


Are you trying to tempt me to use a different special effect? Well, it's
working. :-)

Wow! OMG, this one blows me away.

How do you get the text to display even over graphics without affecting
them?

Are you the original author of this script? If so, then I can credit you
with it in the comments.

Yousuf Khan
Jul 23 '05 #6
Michael Winter wrote:
You missed the point. You can get the same effect, just with an
animated image rather than playing around with the font size. An
image will be more accessible (provided that you use the alt
attribute), and it's guaranteed to work almost in every graphical
browser[1]. The same cannot be said for that script, or any other
like it.


Well, the problem with the graphical way you mention is that I'd have to
obtain a GIF animation package, possibly search around for a freeware one
(if freeware GIF animators even exist considering the patents on GIF), and
then to top it off I'd have to learn to use it in a quick amount of time.
Plus in addition to that those facts, adding another GIF image would
necessarily add a large download strain to anybody viewing the page. It's
easy to forget that with broadband that there are dialup users out there
still, where each additional image is a highly noticeable. I do expect
dialup users will be viewing my page too.

Yousuf Khan
Jul 23 '05 #7
"Yousuf Khan" <bb****@ezrs.com> wrote in message news:<tb*****************@twister01.bloor.is.net.c able.rogers.com>...
victor ebuwa wrote:
That's a very old script and, apologies to the author, not a very good
visual effect.

Try this one: - seems to be hidden from Opera though.


Are you trying to tempt me to use a different special effect? Well, it's
working. :-)

Wow! OMG, this one blows me away.

How do you get the text to display even over graphics without affecting
them?

Are you the original author of this script? If so, then I can credit you
with it in the comments.

Yousuf Khan


No I didn't write it. I found it on an email stationary forum a few months ago.
Jul 23 '05 #8
victor ebuwa wrote:
Are you the original author of this script? If so, then I can credit
you with it in the comments.

Yousuf Khan


No I didn't write it. I found it on an email stationary forum a few
months ago.


Okay, then I guess we can call it public domain then. :-)

Yousuf Khan
Jul 23 '05 #9
Yousuf Khan <bb****@ezrs.com> wrote:
Michael Winter wrote:
You missed the point. You can get the same effect, just with an
animated image rather than playing around with the font size. An
image will be more accessible (provided that you use the alt
attribute), and it's guaranteed to work almost in every graphical
browser[1]. The same cannot be said for that script, or any other
like it.


Well, the problem with the graphical way you mention is that I'd have to
obtain a GIF animation package, possibly search around for a freeware one
(if freeware GIF animators even exist considering the patents on GIF), and


Now-expired patents.
Jul 23 '05 #10
Ian Stirling wrote:
Well, the problem with the graphical way you mention is that I'd
have to obtain a GIF animation package, possibly search around for a
freeware one (if freeware GIF animators even exist considering the
patents on GIF), and


Now-expired patents.


Really? So GIF is can now be used for free again?

Yousuf Khan
Jul 23 '05 #11
On 29 Aug 2004 00:41:11 GMT, Ian Stirling <ro**@mauve.demon.co.uk>
wrote:
Yousuf Khan <bb****@ezrs.com> wrote:
Well, the problem with the graphical way you mention is that I'd have to
obtain a GIF animation package, possibly search around for a freeware one
(if freeware GIF animators even exist considering the patents on GIF), and


Now-expired patents.


Is it expired everywhere now? I know US went in 2003, Europe in 2004
(both June time wasn't it?) but does the patent still exist in any
countries?

Jim.
Jul 23 '05 #12
Jim Ley wrote:
On 29 Aug 2004 00:41:11 GMT, Ian Stirling <ro**@mauve.demon.co.uk>
wrote:


Please do not write attribution novels by duplicating header information.
It does not serve any greater purpose but reduces legibility of discussions.
Yousuf Khan <bb****@ezrs.com> wrote:
Well, the problem with the graphical way you mention is that I'd have to
obtain a GIF animation package, possibly search around for a freeware
one (if freeware GIF animators even exist considering the patents on
GIF), and


Now-expired patents.


Is it expired everywhere now? I know US went in 2003, Europe in 2004
(both June time wasn't it?) but does the patent still exist in any
countries?


Unisys' GIF patent expired in the USA, Europe, Japan and Canada,
however the U.S. IBM patent is still valid until August 11, 2006.

<http://www.gnu.org/philosophy/gif.html>
PointedEars
--
But who will take down the flypaper?
Jul 23 '05 #13
Yousuf Khan <bb****@ezrs.com> wrote:
Ian Stirling wrote:
Well, the problem with the graphical way you mention is that I'd
have to obtain a GIF animation package, possibly search around for a
freeware one (if freeware GIF animators even exist considering the
patents on GIF), and


Now-expired patents.


Really? So GIF is can now be used for free again?


I believe so.
Jul 23 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Matt | last post by:
For debugging javascript purposes, should we ensure the following check boxes (1-3) are checked. In IE browser, tools->Internet Options->Advanced Under Browsing, 1) disable script debugging...
1
by: Johann Blake | last post by:
My ASP.NET application is written using C# script as well as C# code-behind. After setting a breakpoint in the script and running the application, I click from one page to the next but when I...
0
by: ZMan | last post by:
Scenario: This is about debugging server side scripts that make calls to middle-tier business DLLs. The server side scripts are legacy ASP 3.0 pages, and the DLLs are managed DLLs...
4
by: gemel | last post by:
I am trying to debug the client script of a CustomValidator, but VS seems to ignore it completely. This is waht I do: Enable script debugging in Internet Explorer Launch the page from Internet...
5
by: Velvet | last post by:
Can someone tell me to what process I need to attach to be able to step through my classic ASP code in VS.net 2003. I'm working on an XP box with IIS installed. I also have VS.net 2005 (The...
0
by: Finn50 | last post by:
If anyone out there in internet land would like to help an ole man figure out why my php script will not upload gif files (banners) to a sql database please email me and I will supply them with all...
3
by: Namshub | last post by:
I'm having trouble debugging scripts in aspx pages. I have the script explorer working and have 3rd party tools, external scripts and scripts within aspx pages I get the...
5
by: rn5a | last post by:
Can someone please suggest me a text editor especially for DEBUGGING ASP scripts apart from Microsoft Visual Interdev? I tried using Visual Interdev & created a project but Interdev generates...
4
by: =?Utf-8?B?TWlrZSBHYWxl?= | last post by:
VS 2008 initially didn't debug classic ASP. SP1 fixes this in some ways. You can debug if you select the debug option to "Start Without Debugging, then either attach the debugger manually or...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.