View Full Version : wondering why

02-12-2003, 01:32 PM
why is it that some asp files that I download from websites as demos have the following in the <input type="submit" value="Submit" /> when if you put <input type="submit" value="Submit"> without the / and it still works??? makes no sense to me

02-12-2003, 01:51 PM
The forward slash is needed to make the tags forward compliant for XHTML.

In XML (of which XHTML is a flavour) all tags must come in pairs and be correctly closed in order for the document or page to be valid. HTML tags which are usually used singularly such as <img>, <br>, <input> etc. all require this slash so that they are treated as a 'pair'.

It's a good idea to start doing this now in your code so you are ready for the future.

It's also worth noting that all attributes should be enclosed in double quotes and all tags written in lower case.

02-12-2003, 02:06 PM

I will definitaly keep note of that :)

02-13-2003, 02:47 AM
Yup, that's what I do... for a quick tutorial about this, see:



There are a few very rare things that may frustrate you (such as centering tables on a webpage using CSS, and opening windows in new webpages - I had to figure out a couple of workarounds for those with a bit of googling and experimentation!), but overall you'll find using XHTML results in much cleaner code, and it's backwards compatible.

But the drawbacks are few from a programming point of view; if you learn about these things and use them, you'll see for yourself why standards are a very GOOD thing... especially after you start writing XHTML compliant code, you'll look at other people's code and think "man, that's ugly!". ;)

Not to mention it gives you a clearer understanding of the way HTML was intended to work in the first place, before companies like Microsoft and Netscape decided to implement their own "proprietary" tags and functionality.

If there had been standards in the first place, there wouldn't be so many questions like "how can I get my javascript to work with THIS browser and THAT browser?" and "How come my page displays correctly in IE but not in NS?"

It's too late to change the bad things that have happened (such as millions of users creating horribly incorrect HTML pages using FrontPage, Netscape Composer, etc.)... but the more developers stick to standards, the friendlier the web becomes... all this stuff helps the "big programming picture", IMHO.

02-13-2003, 06:11 AM
Thankyou again! Lol Google seems to be a programs best friend lol :)

02-14-2003, 01:09 AM
It is... have no doubt about that. Google is the bomb. :)

I think that's the first place most of the developers I know go for a quick answer to any question (even if it's not about programming). Of course you have to quickly discern what is garbage and skip over that, and I guess you only get that kind of judgment from experience... it's no wonder though why "google it" is such a popular term now.

Because of a colleague's recommendation, I even installed the "google toolbar" on my Internet Explorer browser...

Don't forget about http://www.w3schools.com as a general reference, or this forum's parent site for javascript, http://www.javascriptkit.com !

One of the most important aspects (at least in my opinion) of programming is teaching yourself HOW to learn more efficiently!

For instance, figuring out the best way to research things for yourself, and experimenting with things until they work, until you understand WHY they work.

P.S. The application I'm designing at work right now is XHTML 1.1 compliant, and almost all of it even works in Netscape 4.78...

...except for my "popup mouseover help page" which pops up upon clicking a help icon...

However, I introduce the user to how the application works on the main page with an example help icon, and state "if a help window didn't pop up, then you probably need to use an up-to-date browser". Good enough, since as far as I know their whole company uses IE. Every other aspect of the application works the same in all browsers I've tested... Mozilla, NS 6.x, NS 4.x, IE 5.x (and I'm sure 4, but haven't tried it), and IE 6.