Sometimes things just don't work the way you expected!

Whether you are using HTML editing software or writing the code by hand mistakes can be made. Sometimes the code does not do just what you expected it to. Here are some typical problems and their possible causes.


Q I have copied some JavaScript from another web page, why doesn't it work on my web page?

A1 Normally JavaScript is placed in the <head> section of the web page so that it is read by the browser as the page loads. Depending on the purpose of the JavaScript if you place it anywhere else by the time the browser reads the script it may not be able to operate it. However some JavaScript must be placed in a specific part of the page, for example if the script is supposed to "write" something in a particular part of the page.

A2 JavaScript has to be written in a specific way for it to work. If a single line of script is divided up and placed on two separate lines in the HTML code, the browser will think that the end of the first line is the end of an instruction, so it will treat the second line as a separate instruction and the script will fail to work properly. It is also possible that the script relies on some other HTML or JavaScript somewhere else on the page for it to work.

Images and Hyperlinks

Q Why is there is space between two adjacent images, even when there are no spaces in the HTML code?

A Web browsers interpret carriage returns (line breaks) in the HTML code as spaces. This can be helpful (if you have not put a space at the end of a line of text before a line break - the text will appear as if it did have a space) but it will mess up adjacent images - for example if you are using images as a row of navigation buttons. Instead of typing each <img...> tag on a separate line, type them on one line. You can insert line breaks within the tags and the page will still render properly.

Carriage Return = carriage return

This code will have spaces between the images.

<img src="one.jpg" width="100" height="20" border="0" alt="ONE">carriage return

<img src="two.jpg" width="100" height="20" border="0" alt="TWO">


This code will not have spaces between the images.

<img src="one.jpg" width="100" height="20" border="0" carriage return

alt="ONE"><img src="two.jpg" width="100" height="20" carriage return

border="0" alt="TWO">


Q When I click on a link on my web site why do I get an error message saying the file, that I know exists, has not been found?

A You may have mistyped the path to the file if it's not in the same folder (directory) or you may have used Capital Letters to name the file but not in your hyperlink. Web servers treat capital and lower case letters as different characters, so it's best to always use lower case letters only.

Q When I view my web site on my own PC it looks OK, why do people tell me some of the images do not appear when they view the site on-line?

A This could be because you have created relative links to images located on your PC that are not in any of the folders included in your file upload. When you view the page you will see the images because the relative links are to files on your PC, but other people will not see the files as the images have not been uploaded to the server and the relative image links are to files that do not exist on their PC. You can recognise these relative links, look for the "file:///c:/" in the HTML code similar to this:

<img src="file:///C:/My Pictures/image.gif "border="0" width="140" height="35">

Q On some peoples PC's why do my web pages have additional hyperlinks that I did not put in the HTML code?

A This is because the PC being used has some software on it that reads the HTML code as it is received and alters it before it is displayed. This type of software may be referred to as Scumware, Malware, Adware or Theftware. These types of software may sometimes collect personal information and / or change the appearance of a web page. There are many software applications that do this, they may even have been downloaded without the PC user realising.

Scumware applications add extra hyperlinks to certain words that have been paid for by an advertiser. Often these links go to adult/porn type sites. The original web site designer will not be aware that these links are being added to their pages. Among the software applications that do this are:

  • TopText made by eZula Inc. (supplied with Gator and file-sharing programs KaZaa and iMesh)
  • Surf+
  • ebates
  • The morpheous file-share system may install a Scumware application

The images below demonstrate what these additional links might look like:

The yellow links were not part of the original web page. The green links were not part of the original web page.
image demonstrating links added by software on the PC image demonstrating links added by software on the PC

There is free software you can download to detect and remove these types of programs:

Browser Problems

Q When I view my pages in Internet Explorer centred objects align correctly, but in Netscape Navigator why are they are all aligned to the left?

A Netscape seems to read alignment tags differently so you need to put two different tags in your document to compensate.

This code will not align properly in Netscape. This code will align properly in Netscape.

<div align="center">
<p> ... </p>

<div align="center"><center>
<p> ... </p>

However, if you are using <div> tags and formatting your site with Cascading Style Sheets, instead of using the align attribute you should use the correct CSS float property, or specify left and right padding properties to position your <div> where you want it.

Q Why, when I view my web page with Internet Explorer the background is white, but on some browsers it is grey?

A This is because the browsers have applied their own default values to the background of the web page. To make the background white (or any other colour) you have to specify the value for the bgcolor attribute in the <body... > tag, or in the CSS body attribute.

Q Why does the text in one cell of a table appear in the page but not in its proper cell?

A This is probably due to the software (or you) missing out some of the tags. If you omit the </td> or </tr> tags that signal the end of a table cell or row Netscape Navigator will not start the next cell when it reads the <td> tag, so all the text will appear, but not in separate cells. Microsoft Internet Explorer is better at coping with missing tags, so if you view with Explorer the table would appear properly. If you miss out the </table> tag at the end of a table Netscape Navigator will not display the table at all.

The code for this table is complete. The code for this table is incomplete.
image demonstrating table with complete code image demonstrating table with incomplete code

Q My web page looks right in my HTML editor and when I use Internet Explorer, but when viewed in a different browser why is some of the text black when it should be a different colour?

A If you are using Cascading Style Sheets to format your web pages it is very likely that there is a mistake in your CSS. Just one mistake in a style sheet can stop the style sheet information being read properly by the browser. Internet Explorer is better at displaying pages with mistakes in them (whether in the HTML code or a style sheet) but different browsers might be more particular about the code being exactly right.

Make sure you have not put any of your style sheet attributes within quotation marks, unless the value contains a space (like the name for a font family, e.g.: "Courier New") and that you have put a semi-colon to separate each style sheet variable.

This CSS code will not work properly in Netscape, but might work in Internet Explorer. This CSS code will work properly in all browsers.

.eg1 { font-family: Arial, Helvetica;
    font-size: "12px";
    font-style: italic
    font-weight: bold }

.eg1 { font-family: Arial, Helvetica;
    font-size: 12px;
    font-style: italic;
    font-weight: bold }