Forum Moderators: open
But how come the js still works here? I thought js was case sensitive?
Browsers are not validating parsers, so the only thing they use the doctype for is for switching between quirks and standards-compliance modes. For rendering the page, the browser uses its own internal DTD, dependent solely on mime-type.
If you serve XHTML as
text/html (which virtually everybody does), the browser treats it no differently from plain HTML, including case-insensitive markup, depreciated elements, non-standard elements... The DTD specified in the doctype is ignored completely in all cases, and never even downloaded. So the short of it is that errors of this type only matter to the validator, not to the browser. More serious errors, such as improper nesting, not only fail validation but can also have repercussions in the browser.
Also, I now have another problem with this bit of code now in that in ie5 only, the submit button insists on being on the line below, and I want the search box and submit button to sit next to each other. Here is the code:
<input name="search" id="search" value="search this site" size="15" onfocus="if(this.value=='search this site')this.value='';" />
<input name="Submit" type="submit" value="go" class="quicklinksbutton"/>
I've tried using css to solve the problem but to no avail...
.searchform{
width:25%;
display:inline;
background-color: #daf2e6;
}
.searchform input{
border: 1px solid #009966;
display:inline;
}
works fine in moz and other versions of ie
I haven't used XHTML but I think it specifies that all tags and attributes must be lower case - hence the validation error.
Kaled.
I haven't used XHTML but I think it specifies that all tags and attributes must be lower case - hence the validation error.
That is correct. XML is case-sensitive, and XHTML is "A Reformulation of HTML 4 in XML 1.0" (XHTML 1.0 front page at w3.org). Therefore, XHTML attributes and values must all be lowercase to make debugging code easier.
@kaled: You should consider looking into XHTML. After all, version 2.0 is on its way already! The W3C is just working out the DTD, namespaces, and bugs, and is also taking into consideration the opinions of those concerned about the future of Web authoring. It may be a while, so until it comes out, you should check into XHTML 1.0 at least. Maybe move to XHTML 1.0 Transitional first which is HTML 4 Transitional with everything lowercase and all tags closed (basically).
I do plan to look at XHTML but I don't think I'll have time for this before Christmas. I maintain a website out of necessity rather than choice.
Kaled.
PS
Am I correct in thinking that XML is basically a freeform tag system for describing data in heirarchies? I am planning to move data storage from the Windows registry into a text file shortly and was planning to make it look like XML and possibly use the file extension .XML - Ideally I would like to make it valid XML but so far, all I know about it I've learnt from glancing at XML files.
If you want to play by the strict rules of web standards, you really should put all your JavaScript in an external file and leave the markup alone. Your example could easily be replaced with external DOM javascripts, that could parse your markup upon window load and do the things you want it to do.
Granted, I'm working with HTML 4.01 Trans, but I validated such a page about five minutes ago.
Kaled.