Forum Moderators: mack
I would say run it through a code validator and stay up all night trying to see what went wrong. Any other ideas out there in the trenches?
There are going to be times when our pages don't work (or, some cases, you won't see any result.) Post your list of 5 to 10 troubleshooting recommendations.
Use a valid document type. Although this doesn't insure perfect cross-browser compatibility, it certainly reduces those problems to a minimum.
Use an appropriate document type. Nearly every new page I see is an XHTML doctype. When asked why they chose this, the answer is invariably "Because it's the latest technology." Then you go on to see deprecated elements uses such as <center> and <font> (UGH!) which tells me they have no clue about the selected doctype. It was predicted that XHTML would replace HTML. This is not the case, HTML 5 is being finalized.
XHTML has specific applications, and unless you are actually using those applications and your server is actually serving up the text/xhtml content type, you are making things more difficult for yourself and should be using an HTML doctype. If you don't understand what I just said, all the more reason to NOT use an XHTML doctype.
Both discussed at length here [webmasterworld.com]
Validate your code. W3C validator [validator.w3.org]
Avoid browser-specific "hacks." This is true for plain HTML display, Javascript, server-side programming - never, ever code anything in that addresses a specific browser or version. If it won't work in that browser, find another valid approach that will work for all. The reason: this becomes a never-ending nightmare task, and those hacks may wind up breaking valid later versions of browsers.
Process of elimination. If your code is valid, it's a valid document type, and it's still broken, begin by saving a test file, then cutting out all extraneous elements in the CSS and html, and preview the page in chunks. Put borders on all your elements so you can see what they are up to. Quite often it's the combination of only one or two simple elements that are bringing the whole page down, and this is the fastest way to find them.
Use as many tools as you can understand. By this I mean that FireFox has literally hundreds of plug ins available to help you understand "what's going on" in a number of situations. Some of them are so robust it takes a manual to make use of them, some of them are simple and will accelerate your project and learning curve. Some examples are Live Headers, FireBug, Dust-Me (which locates unused CSS selectors) And YSlow, for example.
I will add, although it validates, always quote all attributes. This is not a troubleshooting tip, but it always helps to be as right as possible.
<a href="some-link.html">link</a>
not
<a href=some-link.html>link</a>
Once you know HTML, you can look at the source code and the problem could be an obvious flaw in the code, easily fixed in Notepad.
Baruch: This is the first I've heard of document.write and echo variable...but, I'll definitely look in to it. Thank you.