Frequently Asked Questions (FAQ) :: EXAMPLE VIRUS ATTACK

Before you try sending me an e-mail, a lot of the e-mails I receive ask very similar questions. It might save you a lot of time to have a read of these answers...!

  1. It works when I test it but not when I upload it?
  2. I already have scripts on my page and when I add yours they all (or some of them) stop working?
  3. When I run the script I get the word 'null' or 'undefined' appearing?
  4. Can you change the script to do something a bit different?
  5. It doesn't work... What do I do?
  6. Why don't you support Netscape or Internet Explorer versions 4 or less?
  7. What exactly is DHTML?
  8. What does 'XML Compliant' mean?
  9. What difference does 'XML Compliant' make?

It works when I test it but not when I upload it?

Many web-hosts (especially the free ones such as 'lycos', 'tumblr' and 'xanga') insert their own JavaScript into a page after you have uploaded it, for example, to launch pop-ups when the page loads, or to show adverts. These scripts mess up any other scripts such as mine, that you might have added. Sadly, there is no simple solution other than moving your site to a better host.

I already have scripts on my page and when I add yours they all (or some of them) stop working?

A lot of scripts (mine included) rely on a thing called an 'onload' event handler. This starts the script running once the page is loaded. Unfortunately, only one onload handler can work at a time on any page; if you have more than one, then none of them work!

In most of the scripts on this site, attempts have been made to overcome this problem by the use of an intelligent 'onload handler' that will try and suss out if there are existing events that need to be dealt with. It doesn't work every time but should reduce this possibility.

The other thing that can cause problems is if two scripts have the same variable or function names. As far as possible, scripts on this site attempt to overcome this but mixing scripts from one site with those of another can cause all sorts of unexpected difficulties.

When I run the script I get the word 'null' or 'undefined' appearing?

Each of my DHTML text effects (but not the graphics effects) requires you to add a '<span>' or '<div>' tag into the body of your HTML page. Inside these tags should be the text you want animating and nothing else. Adding links or images will cause the scripts to stop working and forgetting to put the tags on your page in the first place can be equally disasterous.

Can you change the script to do something a bit different?

If I had to re-write the scripts each time someone wanted them to do something a bit different, I would never get any other work done. By all means drop me a line if you have a good idea for an improvement or for a new script that you would like to see, but don't be offended if the answer is 'no'.

It doesn't work... What do I do?

You wouldn't believe how many times I get asked this question. And the simple answer is "Without more information, I have no idea!" If you are having a problem getting a script to work, and even with the help of these FAQs you still can't get it going, send me a link to the page where the problem is, otherwise you might as well be asking "How long is a piece of string?" for all the assistance I can be. If I can figure out what's going wrong, I'll try and help.

Why don't you support Netscape or Internet Explorer versions 4 or less?

All the scripts on my site rely on using the Document Object Model (DOM). This feature was not available in Internet Explorer or Netscape versions 4 or less and so my scripts will not work in these very early browsers (which are now virtually unheard of). The statistics from my web-site show that these old browser are not in the top 20 of visitors and account for less than 0.1% of the total people who visit, so I do not feel particularly bad about excluding them (they should get an upgrade anyway, it's not as if you have to pay for one!) Here are the actual statistics for the top 20 browsers that visit this site:

Rank Browser Visitors
1 Chrome 120.0 15.00 %
2 Chrome 126.0 8.17 %
3 Chrome 122.0 7.92 %
4 Chrome 121.0 7.91 %
5 Chrome 123.0 7.79 %
6 Chrome 124.0 7.36 %
7 Chrome 119.0 6.86 %
8 Chrome 125.0 5.64 %
9 Chrome 118.0 4.75 %
10 Chrome 127.0 4.18 %
11 Chrome 114.0 3.46 %
12 Chrome 116.0 3.35 %
13 Chrome 111.0 2.53 %
14 Safari 604.1 2.48 %
15 Chrome 109.0 2.47 %
16 Chrome 110.0 2.37 %
17 Chrome 112.0 2.37 %
18 Chrome 117.0 2.07 %
19 Chrome 115.0 1.71 %
20 Chrome 113.0 1.62 %

What exactly is DHTML?

DHTML uses a combination of JavaScript (occasionally, but not often, referred to as ECMA-Script) which is a computer language that your brower can understand and Cascading Style Sheets (CSS), which is a way of changing the style of a given part of a web-page. DHTML scripts typically animate a piece of text or some graphics by changing elements of the style associated with it, such as it's colour, size, location or visibility. As such, DHTML is just a JavaScript programme, hence the reason that the two are often connected.

Just to confuse matters further, there is another language that your browser can understand called Java. Java is much more sophisticated than JavaScript and can produce some stunning visual effects but does require browsers to have a plug-in enabled which many do not.

What does 'XML Compliant' mean?

I have added the xml compliant logo to all the scripts and effects on my pages which work when served with mime type 'application/xhtml+xml'. This means that if you are writing your web-pages in XHTML instead of HTML and serving up these pages as proper XML, the scripts will still work fine. If you have no idea what this means, don't worry, it just means that all those scripts with the logo are compatible with the latest web-page authoring standards - they will work just as well on any web-page!

What difference does 'XML Compliant' make?

To make scripts work properly when served as XML (application/xhtml+xml) a number of changes need to take place. By far the largest change is that the JavaScript function 'document.write' does not work. In some browsers (Firefox 1.0 for example) the 'innerHTML' property is read-only meaning that you can not use this function to modify the page either. Hence any modifications to the page need to be done using the W3C Document Object Model (DOM) which makes some scripts a little more complicated (and whilst in theory makes cross-browser support easier, it still throws up lots of problems).

One other change that needs to take place is that the code within the '<script>' tags needs to be enclosed in the proper XML comment tags '<![CDATA[' and ']]>' instead of the HTML comment tags '<!--' and '-->', otherwise the browser will ignore the code altogether. Whilst using the XML tags may cause problems to some very early browsers, even good (bad?) old Netscape 4 can cope with them without causing a problem and hence the change is (give or take) fully backwards compatible.

Copyright notice: All scripts are © copyright mf2fm.com. You can use them wherever and whenever you wish, however the copyright notice at the start of the script should remain intact and a link back to this page would be appreciated. The address for this page is: http://www.mf2fm.com/rv/dhtmlfaq.php.

This page has been viewed 204 times. It was last viewed on Sun 18 Aug, 2024 at 17:47

welcome visitor