Loading ...
Sorry, an error occurred while loading the content.

Re: [NH] What's So Great About XHTML?

Expand Messages
  • Rijk van Geijtenbeek
    On Sun, 15 Dec 2002 14:45:52 -0000, wilkinsonm ... Scripts using ID should still work in recent browsers, but will fail in Netscape 4 and
    Message 1 of 7 , Dec 15, 2002
    • 0 Attachment
      On Sun, 15 Dec 2002 14:45:52 -0000, wilkinsonm <mikew@...>
      <mikew@...> wrote:

      > I've read that HTML authors should move to XHTML because it requires more
      > consistent coding and is a step toward XML. OK, I thought I'd play along,
      > but I discovered that the "name" attribute is deprecated in favor of
      > "id." Unfortunately, if I use "id" instead of "name," my javascripts
      > don't work.

      Scripts using ID should still work in recent browsers, but will fail in
      Netscape 4 and old IE versions.

      > Documentation at w3.org suggests that I should consider using both "name"
      > and "id," but then I will always get error messages if I validate the
      > code.
      >
      > All of this leads me to my question. "What's so great about XHTML?"

      XHTML is needed if you make use of automated systems like XSLT processors
      on the server. Otherwise there's little gain relative to writing valid HTML
      4.01 Strict, which is basically the same, but with a slightly different
      syntax. Using deprecated elements and attributes (and so the Transitional
      doctype) is only needed if you don't know enough CSS to get the same
      effects, or if you still want to support Netscape 3.

      --
      If you don't like having choices | Rijk van Geijtenbeek
      made for you, you should start |
      making your own. - Neal Stephenson | mailto:rijk@...
    • Jason Waugh
      Hi wilkinsonm, wmwc Maybe I just don t know how to get JavaScript to find the value of a wmwc text field (for example) unless it is named. wmwc Normally I
      Message 2 of 7 , Dec 15, 2002
      • 0 Attachment
        Hi wilkinsonm,

        wmwc> Maybe I just don't know how to get JavaScript to find the value of a
        wmwc> text field (for example) unless it is named.

        wmwc> Normally I could read the value of the text field using JavaScript
        wmwc> like this:

        wmwc> var value = document.form1.input1.value

        I would do it like this:

        <form name="form1" action="etc.htm">
        <input id="input1" (other attributes)>
        </form>

        And then in javascript, I can refer to that input element's value
        with:

        document.getElementByID("input1").value

        This is (IMO) a better way to do it anyway, because that input field
        is no longer even tied to a form... it could be anywhere. In this way
        you can pull other tricks too, like for instance you can take any text
        on the page at all, or whole forms, or anything and surround it with
        one of these:

        <div id="thissection"></div>
        or
        <span id="thissection"></span>

        And have the action of a checkbox call a javascript that does
        something like this:

        document.getElementByID("thissection").style.visibility = "hidden"

        and hide that portion of the page. "getElementByID" in conjunction
        with ID tags will very quickly become your friend.



        wmwc> However, do you really, honestly, realistically think XHTML will make
        wmwc> pages render correctly on all browsers? It just seems too good to be
        wmwc> grue, considering the history of Internet Explorer, Netscape, etc,
        wmwc> etc.


        Well, the problem is that we are in a poor state now. Browser vendors
        and authors both have to work to set things right. By coding in valid
        XHTML, we can do our part, as well as ensuring that our pages will be
        usable in fashions we can't even imagine at the moment.



        Regards,
        Jason Waugh
      • wilkinsonm <mikew@wtribe.com>
        ... Thanks for the tip! ... OK - that makes sense. Thanks again, Mike Wilkinson
        Message 3 of 7 , Dec 15, 2002
        • 0 Attachment
          >"getElementByID" in conjunction
          > with ID tags will very quickly become your friend.
          >

          Thanks for the tip!


          > Well, the problem is that we are in a poor state now. Browser vendors
          > and authors both have to work to set things right. By coding in valid
          > XHTML, we can do our part, as well as ensuring that our pages will be
          > usable in fashions we can't even imagine at the moment.

          OK - that makes sense.

          Thanks again,

          Mike Wilkinson
        • Jason Waugh
          JW document.getElementByID( input1 ).value My apologies to anybody who read this, it s getElementById (with a lowercase d ). -- Regards, Jason Waugh
          Message 4 of 7 , Dec 15, 2002
          • 0 Attachment
            JW> document.getElementByID("input1").value


            My apologies to anybody who read this, it's getElementById (with a
            lowercase "d").

            --
            Regards,
            Jason Waugh
          Your message has been successfully submitted and would be delivered to recipients shortly.