Java Script

T

Trevor L.

Kevin,

Thanks again for the wonderfully comprehensive reply. I will digest at my
lesisure. Actually, I was surprised to see an answer this late at night. It
is now nearly 1 a.m. AEST Monday morning, but in Virginia, it would be 10
a.m. (??) Sunday morning.

I am late up keeping watch on a write to DVD of some movies I took in NZ in
September. Just as well, as I had to delete some files to make room on my
disk drive. I only have 40GB so I probably need to invest in a larger disk -
200 GB would be nice, given the space movies chew up. Why the video program
needs to use so much disk when it is writing to DVD, I really don't know,
but that is another story and OT for this NG.

I have been thinking of looking XML and XHTML. They are different "beasts" I
take it. I assume all (most) browsers support these languages. As for ASP,
etc. I am rather limited in that I am using a free webspace provided by my
ISP. It is an FTP site (using Linux, I think) and doesn't support FP
extensions or any server-side software. I am loking to find a free site to
practice on that does support server-side software. I haven't found any
Aussie ones yet, but I have seen a few US ones, by Googling for "Free Web
Sites". If you or anyone else has some recommnendations, I would be
grateful. (I have seen some postings on this so I am following up on a few.)

BTW, I haven't many photos of Australia on the web at the moment, but you
can visit http://trevor.lawrence-2.fotopic.net/ to see what is there. This
site also has a fair few of NZ taken in Sept.

My wife likes to take photos of buses, trains, etc and these are at
http://carole.lawrence.fotopic.net/ (This includes quite a few taken in NZ.)
 
K

Kevin Spencer

I have been thinking of looking XML and XHTML. They are different "beasts"
I take it. I assume all (most) browsers support these languages.

Yes, XML and XHTML are different, but only in the same way that rectangles
and squares are different. XHTML is XML. However, XML can take on many
forms, such as XHTML, XAML (Extensible Application Markup Language), DTD
(Document Type Definition), XSD (Extensible Schema Definition), XSL
(Extensible StyleSheet Language), and many others.
BTW, I haven't many photos of Australia on the web at the moment, but you
can visit http://trevor.lawrence-2.fotopic.net/ to see what is there. This
site also has a fair few of NZ taken in Sept.

Stunning! Your friend is quite the photographer! Makes me want to visit
these places all the more!
My wife likes to take photos of buses, trains, etc and these are at
http://carole.lawrence.fotopic.net/ (This includes quite a few taken in
NZ.)

--

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.

Fascinating. Reminds me of the gilem "The Station Agent," which was about
people who have a fascination with trains!
 
K

Kevin Spencer

Oh, sorry. *You're* quite the photographer, Trevor!

--
:-D,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.
 
T

Trevor L.

Kevin said:
Yes, XML and XHTML are different, but only in the same way that
rectangles and squares are different. XHTML is XML. However, XML can
take on many forms, such as XHTML, XAML (Extensible Application
Markup Language), DTD (Document Type Definition), XSD (Extensible
Schema Definition), XSL (Extensible StyleSheet Language), and many
others.

Kevin,
A belated reply

I have just got around to trying XHTML and need some help.

If there is a better forum, please let me know.




I started with my main page, added the following DTD and changed the html tag
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

I then went through and tried to convert all the other tags.

I still have these problems
(Reference: http://validator.w3.org/check?uri=h...=Inline&ss=1&outline=1&sp=1&No200=1&verbose=1 )

Error Line 68, column 85: document type does not allow element "body" here .
....;initbutterfly();showPage();greet();">The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

However, all my meta and link tags are closed and I can find no other errors

Error Line 83, column 76: element "embed" undefined .

You have used the element named above in your document, but the document type you are using does not define an element of that name. This error is often caused by:

a.. incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Frameset" document type to get the "<frameset>" element),
b.. by using vendor proprietary extensions such as "<spacer>" or "<marquee>" (this is usually fixed by using CSS to achieve the desired effect instead).
c.. by using upper-case tags in XHTML (in XHTML attributes and elements must be all lower-case.
What do I use instead of <embed>?

Error Line 96, column 5: "if" is not a reserved name .

<![if !IE 6]>The conditional comment is not recognised. Is this to be expected?Error Line 314, column 6: end tag for "html" which is not finished . </html>Most likely, You nested tags and closed them in the wrong order. For example <p><em>...</p> is not acceptable, as <em> must be closed before <p>. Acceptable nesting is: <p><em>...</em></p> Another possibility is that you used an element which requires a child element that you did not include. Hence the parent element is "not finished", not complete. For instance, <head> generally requires a <title>, lists (ul, ol, dl) require list items (li, or dt, dd), and so on.I think this is connected to the first error but what is wrong?-- Cheers,Trevor L.Website: http://tandcl.homemail.com.au(see website to send email)
 
K

Kevin Spencer

A commendable endeavor, Trevor!

It may take awhile to get used to XML in general, but in fact, it is much
simpler (though much more strict) than HTML. In fact, the strictness is part
of its simplicity. You may find the following link very helpful. It is to
the Microsoft XML Developer center, and there is a huge amount of
information available there.

http://msdn.microsoft.com/XML/default.aspx

It helps to understand the rules of XML in general, as they *all* apply to
any XML derivative, which is one of the things that makes it so simple, even
though, like Chess, which has only 32 pieces of 12 different types on an 8X8
board, the permutations of it are nearly infinite. Microsoft also has an
excellent reference on XML standards, which you may find helpful:

http://msdn.microsoft.com/XML/Understanding/XMLSpecs/default.aspx

Also, it could take you awhile to find this, so I'm supplying it here, the
W3C XHTML Standard Specification:

http://www.w3.org/TR/xhtml1/

In this case, let's start with the basics. The basic building block of XML
(and therefore XHTML) is the "element." An element is text that is enclosed
with <angle brackets>. An XML document must have a "root element," which in
your case would be the tag:

<html xmlns="http://www.w3.org/1999/xhtml">

This element must be preceded by a DOCTYPE tag, which defines what Document
Type Definition it conforms with. This is used by a User Agent application
(such as a browser or XML parser) to read the contents of the document, by
reading the DTC at the URL specified:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

Typically, XML documents require an XML declaration, and the W3C recommends
it, but it is not required for XHTML. The XML declaration, if used, should
be the very first element of the page, and looks similar to this:

<?xml version="1.0" encoding="UTF-8"?>

Your document doesn't have one of these, but that's okay.

The rest of the document must be "well-formed," an XML term which basically
means that all element tags have ending tags. That is, when you have a <p>
tag, for example, you must have a </p> tag somewhere after it. An element is
a container. The beginning and ending tags define the boundaries of the
container. The only exception for this is "empty" tags, such as <br/>,
<hr/>, <meta/> <input.../>, etc. Empty tags are tags with no content (text
between the tags). The rule for empty tags is that they contain the "/"
terminator in them. Note that there are a couple of exceptions: The root
element, the XML declaration, the DOCTYPE element, and <!-- comments -->.

Elements cannot overlap. If an element begins inside another element, it
must also end inside the other element. This is known as "nesting." In HTML,
overlapping is allowed, but not in XHTML (or XML).

All element names ( <elementname id="elementId">"elementname" is the name of
this element.</elementname> ) must be in all lower case. This is also
different from HTML.

All element atributes (an attribute is a name="value" pair) must be enclosed
with double-quotes. This is also more strict than HTML.

All attributes must be full name="value" pairs. In HTML, you can use, for
example:

<checkbox name="C1" checked> (the word "checked" is called a "minimized"
attribute)

In XHTML, that would have to be:

<checkbox name="C1" checked="true"/>

Note that the checkbox also has to have a closing tag, as it is not empty
(it contains attributes).

JavaScripts must be enclosed in CDATA sections. A CDATA section is a section
which may contain any text, without regard for the rules of XML. The opening
and closing script tags are elements containing a CDATA section, as in the
following example:

<script type="text/javascript">
<!CDATA[
function doSomething()
{
/* ... */
}
]]>
</script>

There are a couple of exceptions here also. The "&" character may not appear
inside a CDATA section, nor can the "]]" character sequence. If your script
(or CSS stylesheet) uses either of these, use an external script or
stylesheet.

XML is case-sensitive. "TYPE" and "type" do not mean the same thing. All
pre-defined attributes in XHTML are lower case by definition. Note that this
does not preclude you from creating non-pre-defined attributes with mixed or
upper case names, but applies only to pre-defined attributes, such as "type"
( <input type="text/> for example).

And that's about it! There are a few others. I would recommend reading the
spec.

Now, you should be able to figure out what you did wrong from here. To begin
with, the page in question seems to be using the wrong DTD. It is not a
frameset, but is inside a frameset. That makes it a regular page. I would
recommend using the Transitional DTD, as your page has quite a bit of
"extra" stuff in it.

The use of the "embed" tag is proprietary to Netscape, and is not part of
the DTD.

The following page has some excellent tips for converting HTML into XHTML:

http://www.nypl.org/styleguide/xhtml/tips.html

The HtmlTidy software should be useful.

I might caution you that your page contains a *lot* of scripting,
browser-detection code, and use of styles. You may have your work cut out
for you! I'm not sure I would even bother quite yet. It would be better, if
you want to learn XHTML, to start small!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Complex things are made up of
Lots of simple things.


Kevin said:
Yes, XML and XHTML are different, but only in the same way that
rectangles and squares are different. XHTML is XML. However, XML can
take on many forms, such as XHTML, XAML (Extensible Application
Markup Language), DTD (Document Type Definition), XSD (Extensible
Schema Definition), XSL (Extensible StyleSheet Language), and many
others.

Kevin,
A belated reply

I have just got around to trying XHTML and need some help.

If there is a better forum, please let me know.




I started with my main page, added the following DTD and changed the html
tag
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

I then went through and tried to convert all the other tags.

I still have these problems
(Reference:
http://validator.w3.org/check?uri=h...=Inline&ss=1&outline=1&sp=1&No200=1&verbose=1 )

Error Line 68, column 85: document type does not allow element "body" here .
....;initbutterfly();showPage();greet();">The element named above was found
in a context where it is not allowed. This could mean that you have
incorrectly nested elements -- such as a "style" element in the "body"
section instead of inside "head" -- or two elements that overlap (which is
not allowed).

One common cause for this error is the use of XHTML syntax in HTML
documents. Due to HTML's rules of implicitly closed elements, this error can
create cascading effects. For instance, using XHTML's "self-closing" tags
for "meta" and "link" in the "head" section of a HTML document may cause the
parser to infer the end of the "head" section and the beginning of the
"body" section (where "link" and "meta" are not allowed; hence the reported
error).

However, all my meta and link tags are closed and I can find no other errors

Error Line 83, column 76: element "embed" undefined .

You have used the element named above in your document, but the document
type you are using does not define an element of that name. This error is
often caused by:

a.. incorrect use of the "Strict" document type with a document that uses
frames (e.g. you must use the "Frameset" document type to get the
"<frameset>" element),
b.. by using vendor proprietary extensions such as "<spacer>" or
"<marquee>" (this is usually fixed by using CSS to achieve the desired
effect instead).
c.. by using upper-case tags in XHTML (in XHTML attributes and elements
must be all lower-case.
What do I use instead of <embed>?

Error Line 96, column 5: "if" is not a reserved name .

<![if !IE 6]>The conditional comment is not recognised. Is this to be
expected?Error Line 314, column 6: end tag for "html" which is not finished
.. </html>Most likely, You nested tags and closed them in the wrong order.
For example <p><em>...</p> is not acceptable, as <em> must be closed before
<p>. Acceptable nesting is: <p><em>...</em></p> Another possibility is that
you used an element which requires a child element that you did not include.
Hence the parent element is "not finished", not complete. For instance,
<head> generally requires a <title>, lists (ul, ol, dl) require list items
(li, or dt, dd), and so on.I think this is connected to the first error but
what is wrong?-- Cheers,Trevor L.Website: http://tandcl.homemail.com.au(see
website to send email)
 
T

Trevor L.

Kevin,
Fantastic and lots to read and explore.

I didn't think my main page was so heavily loaded with lots of extras, but I
guess it is - it has grown like topsy.

I didn't think I had any browser detection. My detect() function is to
redirect to the root page if a visitor enters directly.
Of course I do have the code
<!--[if gte IE 4]>...........<![endif]-->
and
<![if !IE]>..............<![endif]>
which a different type of browser detection - not JS but conditional
comments.
Is this code unique to MS, in particular IE?
If so, I may have to ditch it or revert to some type of browser detection in
JS.

I assume XHTML objects to the conditional comments and also to <embed>. I'll
have to find a way around the <embed> problem - I thought this was fairly
common usage for adding sound and video (and also Flash - not that I have
the Flash editor to create anything with).

The point that I would like to crack first is why does the validator say:
Error Line 68, column 85: document type does not allow element "body" here

Still, as I say, plenty to read and avenues to explore. I'll start by
changing the DTD to Transitional and then maybe start with a very much cut
down page - just <head> and a blank <body> and see what happens

Of course, I don't *have* to perservere. The "if it ain't broke" rule could
be applied, but that would spoil the fun of getting it right :))
 
K

Kevin Spencer

Hi Trevor,
Of course, I don't *have* to perservere. The "if it ain't broke" rule
could be applied, but that would spoil the fun of getting it right :))

A man after my own 'eart! ;-)

The difference in browsers vis a vis HTML standards, which are relatively
new, is daunting. It becomes even moreso with the addition of CSS and
JavaScript into the mix Fortunately, standards organizations like the W3C
and ECMA are providing some sanity to the mix, but new software takes time
to develop. Currently, the big software vendors are agreeing in principle to
adhere to the standards, and most browsers are more or less caught up with
the latest. However, Internet Explorer has been at version 6 for about 3
years now, and has fallen seriously behind. The good news is that IE 7 is
slated to come out within the next 6 months! As a guess, I would have to
venture that the slowness is due to its integration with Windows, and the
major overhaul that the next version of Windows (Vista) has undergone.

I'm surprised that several browser manufacturers (at least) haven't yet
thought of the idea of making a browser that is smart enough to read the
DTDs for itself, but I wouldn't be surprised to see that happen sometime in
the near future. After all, if I've thought of it, better minds than mine
must have!

The good news, as far as you're concerned, is that validators are not "The
Internet Police." Don't get me wrong; validators are extremely useful tools
for double-checking your code. But standards are not requirements. Let me
explain.

The chief purpose of standards is to remedy the problem of
cross-platform-compatibility with regards to client applications that work
with data such as web pages, database data, email, newsgroups, and all kinds
of other data that may be exchanged over the Internet. Standards at an
"above-protocol" level are, as I mentioned, relatively new. As an example,
I'll discuss HTML and browsers a bit. As you know, the greatest problem with
HTML today is getting it to look and behave the same in all browsers.
Standards are an effort to provide a voluntarily-followed set of known HTML
document structure, JavaScript language and structure, Style Sheet language
and structure, and so on, which browser vendors can adhere to, and thus
present users with information that is easier to use, as it looks and
behaves more or less the same in whatever software one chooses to have and
use.

JavaScript is a particularly problematic aspect of all this. HTML, as you
recall, was originally developed as a markup language for documents.
JavaScript (together with HTML and CSS) is used to create a user interface
out of an HTML document, and a user interface is quite a different animal
than a document. For one thing, it is interactive. It changes in its
appearance and behavior. The HTML DOM (Document Object Model) has had to
undergo some serious tranformations to accomodate this interactivity, with
the enhancements of, for example, properties and events being added to the
various types of elements, so that the "document" (or, perhaps more
accurately, "user interface") can react to different types of user
interaction. The standards organizations have been slow to upgrade the DOM
and the JavaScript standard, for whatever reasons, and browsers, though most
of them support almost the entire existing DOM, have had to implement
non-standard DOM extensions of their own to satisfy the demand. The vendors
have agreed between themselves to certain of these extensions, but
identifying them, and accomodating the differences between browsers, is
still a monumental effort.

XHML is an attempt to solve a slightly different aspect of this problem,
that being extensibility. As HTML was/is not easily extensible, and has
evolved, the rules for HTML have become increasingly complex and therefore
hard to understand and for developers to work with. XHTML is by nature
easily extensible, as XML is self-describing (via DTDs (Document Type
Definitions), XSD (eXtensible Schema Definition), and so on. And it will no
doubt supplant HTML - eventually.

This does not restrict sfotware vendors from coming up with their own
extensions, proprietary enhancements, etc. It simply provides a core set of
standards which enable a developer to adhere to for cross-platform
compatibility. This is an extremely important point.

Now back to the validators. What this leaves is a set of core standards
which software vendors are working to adhere to, but have yet to do so
completely, and a variant set of proprietary extensions that exist on
different browsers for different proprietary purposes. Internet Explorer,
for example, MUST support certain OS user interface interaction that is not
related to HTML or web sites. As long as these proprietary enhancements do
not overrule the standards, it will be entirely possible for developers to
breathe a sigh of relief, and develop web pages and web application
interfaces with much less difficulty.

What the validators are designed for, then, is a way of checking what *is*
standardized, and informing developers of any inconsistencies with the
standards that exist in their work. This makes the development process much
easier, and enables the developer to be more productive. In other words,
validators are tools that simplify and streamline the development process.
They warn the developer of areas that may need attention, things in their
code that *may* cause issues on different browsers.

In many cases, these are not issues at all. For example, there is an
"element" object in the DOM. It represents all document elements (tags that
are delimited with <less than/greater than> characters). These tags
represent objects in the DOM. There is not, however, an existing method in
the standard DOM for scrolling a scrollable window or scrolling element to
the position of any given element. There are, however, a couple of methods
in almost all browser implementations for doing this. The most common one is
the "scrollTo()" method of the element object. It can be safely used in any
HTML document without fear of any major browser not supporting it. But it
will not validate, as it is not yet part of the W3C Document Object Mode.

So, if you were validating an HTML page which contained this particular
code, it would tell you that there was a violation in the page. Would this
mean that you should not use this in the page? Certainly not. If you needed
such functionality, there is no standard that provides it as of yet.

In other words, validators are not Internet "Meter Maids" that will give you
a ticket if you don't meet all the standards. They are there for the
*convenience* of developers. They are *not* a substitute (yet) for knowing
what is supported in which browsers. They do not even (yet) serve as
guidlines regarding any "Best Practices," except where there are standards
that exist and are more or less universally supported.

This is important to keep in mind, as it is not well understood, and the use
of these validators has derailed many a well-meaning but uneducated
developer and/or client from completing a task or project.

Of course, this makes things very difficult at present for developers like
you and me, to make sense of the output of these validators. One cannot
simply look at a warning message and say "I need to fix this," or "the right
thing to do here is to do this." Instead, if one wants to "get it right,"
one must often do some serious and difficult research. This is particularly
true in the case of DHTML (JavaScript combined with CSS and HTML). Finding
the correct information regarding what JavaScript is supported by what
browsers is difficult, to say the least.

I tend to stick to making it work in FireFox, and IE6, which covers most
existing browsers. The FireFox JavaScript documentation is pretty bad,
though. Fortunately, FireFox comes with tools for inspecting the DOM of any
HTML document loaded, both as HTML, and with regards to JavaScript
scripting. And the Microsoft MSDN library has an excellent section of DHTML,
which includes not only the Microsoft object model, but identifies whether
or not certain things are standardized. So, when deciding on what objects,
properties, and methods to use, a look into the Microsoft reference provides
a suggested solution, and a look at the DOM in FireFox either confirms or
denies that such an object, property, or method will be supported in most
othe browsers.

In addition, FireFox has a JavaScript console, which provides some basic
information about JavaScript exceptions thrown, and more importantly,
Internet Explorer comes with JavaScript debugging capabilities.

Okay, now to your specific questions. I cannot give you an authoritative
answer without testing myself, which I don't have the time to do, but
hopefully I can provide some guidance.

<![if !IE]>..............<![endif]>

This is a conditional comment. Conditional comments are only recognized by
IE 5 and IE 6, and not by any other browser. This serves as a hack for
JavaScript detection, in that anything inside it will be ignored by any
other browser than IE, and therefore, will only be executed *by* IE. You can
read more about Conditional Comments, and their use in hacking IE, at:

http://www.quirksmode.org/css/condcom.html

NOTE: IE 7 is a valiant attempt by Microsoft to adhere to all existing
standards. It will fall *slightly* short of the mark, due, according to
Microsoft, to time constraints. However, conditional comments, which are not
part of any standard, will no longer be supported. Something to keep in
mind, as there is already quite a hubbub of activity out there to prepare
existing hacked web pages for the new version of IE.
Error Line 68, column 85: document type does not allow element "body" here

I suspect this is because you're referencing the Frameset DTD in your page,
rather than either the Strict or Transitional DTDs (there are three
different ones for differing purposes). The Frameset DTD is for Framesets,
and the page in question is not a frameset. It is simply an XHTML document.
The fact that it is, in this case, loaded *into* a frameset, is irrelevant.
The frameset is the document containing the frame definitions, and a
frameset can load any web document into these frames.

Still, as I say, plenty to read and avenues to explore. I'll start by
changing the DTD to Transitional and then maybe start with a very much cut
down page - just <head> and a blank <body> and see what happens

An excellent idea, and one that I often use myself, when better methods are
not available, for debugging purposes of all kinds. Strip away as much as
possible, and begin adding it back in by degrees until an exception occurs.
Deal with each exception piecemeal in this way. Rather than trying to
swallow the whole elephant, bit off a chunk at a time to avoid indigestion!
;-)

You may also benefit from the following link. DTDs are written to be
concise, not easily read (at least by human beings!). They define shorthand
terms and names, and then refer to these shorthand terms and names
throughout the document. While this is certainly as concise as possible, it
makes for very difficult reading. The following link is a "crash course" on
reading DTDs:

http://www.autisticcuckoo.net/archive.php?id=2005/05/01/art-of-reading-dtd

Good luck, my friend!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Complex things are made up of
Lots of simple things.

Trevor L. said:
Kevin,
Fantastic and lots to read and explore.

I didn't think my main page was so heavily loaded with lots of extras, but
I guess it is - it has grown like topsy.

I didn't think I had any browser detection. My detect() function is to
redirect to the root page if a visitor enters directly.
Of course I do have the code
<!--[if gte IE 4]>...........<![endif]-->
and
<![if !IE]>..............<![endif]>
which a different type of browser detection - not JS but conditional
comments.
Is this code unique to MS, in particular IE?
If so, I may have to ditch it or revert to some type of browser detection
in JS.

I assume XHTML objects to the conditional comments and also to <embed>.
I'll have to find a way around the <embed> problem - I thought this was
fairly common usage for adding sound and video (and also Flash - not that
I have the Flash editor to create anything with).

The point that I would like to crack first is why does the validator say:
Error Line 68, column 85: document type does not allow element "body" here

Still, as I say, plenty to read and avenues to explore. I'll start by
changing the DTD to Transitional and then maybe start with a very much cut
down page - just <head> and a blank <body> and see what happens

Of course, I don't *have* to perservere. The "if it ain't broke" rule
could be applied, but that would spoil the fun of getting it right :))
--
Cheers,
Trevor L.
Website: http://tandcl.homemail.com.au
(see website to send email)
 
T

Trevor L.

Kevin,
Again, many thanks for your informative reply.

Re the points raised.

1. The message "<body > invalid here" *was* due to using Frameset DTD rather
than Transitional - changing the DTD removed the error

2. I suspected conditional comments were IE only, and would not be valid in
all browsers (or to the validator). So I have to think what I am trying to
do with these tests. Basically, I use IE6 and Firefox, and if something
doesn't work in Firefox, I want to give a warning or not execute the code
(or both). So I guess I will test which code doesn't work and test for that.
For example, if (document.getElementById) {} else {} - not a good example as
it works in both IE6 and Firefox and I suppose most other browsers :)

3. I am still wondering about <embed> which you say is Netscape but seems to
work quite O.K. in IE6 and Firefox - I'll probably end up ignoring the
error.

Some more good reading ahead of me
 
K

Kevin Spencer

Nice work Trevor!

I don't think you'll run into any major issues with the <embed> tag. It is
important to note that the standard tag for this is <object>. However, the
object tag, which *is* supported in IE, is *not* supported in some browsers
at this point (to my knowledge). But, with the vendors moving towards
standards, keep an eye on it; it may not work in future versions.

I would also not worry about the conditional comments ... yet. They will
only work in "quirks" mode in the next version of IE, for which Microsoft is
going to great lengths to try not to make problems for existing hacks, but
will. And eventually they will not be supported at all. So, that is also
something to keep an eye on in the future. The conditional comments are a
method for getting IE to do something that makes standard stuff look the way
it should in IE, so it may be best to leave it in right now.

Along these lines, the following page and links from that page should help
you in this:

http://blogs.msdn.com/ie/archive/2005/10/12/480242.aspx

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
There's a seeker born every minute.
- Dr. "Happy" Harry Cox
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top