My HTML exploration probably peaked in the days of Netscape 4 and IE 4, so I’ve been left with many bad habits from those grim days when standards were little more than a twinkle in the eye (as opposed to now, where to most they’re still little more than a wailing infant).
All programmers have a history of silly things that caught them out and resulted in an immense amount of time wasted. My favourite one comes from when I was teaching a Delphi course to UNISA students in the day. Syntax such as:
if (a = b)
is perfectly acceptable in Delphi. Later that evening, I was ready to code up a storm in Perl. However I got stuck early on, and spent ages trying to work out why some logic wasn’t working properly. It turns out I was using something like:
if ($a = $b)
instead of
if ($a == $b)
A miserable equal sign cost me a good night’s sleep (and I also relearned the rule that if you don’t see something immediately, take a break – you’ll probably see it quickly when you return).
This week’s mistake, while it didn’t cost me much time, meant there was a bug on a site for much longer than there needed to be.
Anyone who knows HTML can tell you that
<a href='blah.php' target='_blank'>
will open up the page in a new window, right? Wrong. Firefox is a little more picky than that, and the line needs to read:
<a href='blah.php' target="_blank">
It’s the first time I’ve ever known of a difference between double quotes and single quotes in HTML. I tend to use single quotes all the time, since in PHP
$x = "<h3 class='c'>Take me to $place/h3>";
is a lot easier than
$x = '<h3 class="c">Take me to '.$place.'</h3>';
Live and learn 🙂
Single quotes in html have always bugged me. I just use double quotes, but that’s just my personal style, find it easier to read in all normal coding. Single quotes are actually my pet peeve, but with PHP it makes more sense to use it like you do.
Both quotes are allowed as per HTML spec though, but I would have expected the attribute target to require single quotes, not the URL…. strange
http://www.w3.org/TR/html4/intro/sgmltut.html
Maybe it had something to do with your Doctype, perhaps FF is very finicky with that.
This is quite an interesting article on trailing slashes…must say I’ve never gives much care to those…. they seem just to apply to XHTML
http://www.webmasterworld.com/forum21/10248.htm
I remember teaching XHTML in 1998, getting students to close tags, thinking it was just around the corner from mainstream acceptance. Now that it probably is really just around the corner, I’ve got lazy, and don’t bother anymore.
kindly e-mail past unisa delphi papers.
thank you