A tag: href vs. onClick

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Randy Webb

    #46
    Re: A tag: href vs. onClick

    VK said the following on 10/26/2005 1:43 PM:[color=blue]
    > Matt Silberstein wrote:
    >[color=green]
    >>So, instead of referencing #, should one put an anchor at the link and
    >>reference that? That is, make the non-JavaScript link just go right
    >>were it is?[/color]
    >
    >
    > You just going right by middle 90's road. This is how first JavaScript
    > programmers had to twist their minds. If you would *read my posts in
    > this thread* you'll see the self-linked link mentioned. As it said
    > where,
    > <a href="#foo" name="foo"> trick is not usable neither for two reasons:
    >
    > 1) It crashes IE 3.x / IE 4.x which is not important anymore though[/color]

    Does this crash them:

    <a href="#foo">Lin k Text</a><a name="foo">

    ?
    [color=blue]
    > 2) On a big page it still scrolls, so the self-linked link would be
    > placed at the top of the page.[/color]

    Top of the page or top of the viewport? I think it would scroll to the
    top of the viewport, instead of top of the page. I think that is what
    you meant.



    --
    Randy
    comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly

    Comment

    • Randy Webb

      #47
      Re: A tag: href vs. onClick

      VK said the following on 10/26/2005 1:27 PM:
      [color=blue]
      > If we are staying on the *pure purisme* positions then no one of
      > proposed methods is correct including but not limited to "Best
      > Practice" advises.
      >
      > We have to completely forget then <a> element as not intended and
      > having nothing to do with JavaScript code execution.
      >
      > The two approaches we have then are:
      >
      > 1) Use a neutral tag to imitate link behavior. <noscript> and
      > conditional comments should be used to provide all necessary info to
      > customers w/o JavaScript, CSS or neither of both.[/color]

      And it still does not cover the scenario where a script error will cause
      all scripts on the page to stop functioning. The NOSCRIPT element does
      not cover that aspect.

      It also does not cover a scenario as such in script enabled non-IE browsers:

      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
      "http://www.w3.org/TR/REC-html40/strict.dtd">
      <html>
      <head>
      <script type="text/vbscript">
      Dim MyVar
      MyVar = MsgBox ("Hello World!", 216, "MsgBox Example")
      ' MyVar contains either 1 or 2, depending on which button is clicked.
      </script>
      </head>
      <body>
      <P>This is the body of the document</P>
      <noscript>
      <P>You have scripting disabled</P>
      </noscript>
      </body>
      </html>

      Test that code in Opera or Firefox.
      --
      Randy
      comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly

      Comment

      • VK

        #48
        Re: A tag: href vs. onClick

        Randy Webb wrote:[color=blue][color=green]
        > > VK said the following on 10/26/2005 1:27 PM:
        > > 1) Use a neutral tag to imitate link behavior. <noscript> and
        > > conditional comments should be used to provide all necessary info to
        > > customers w/o JavaScript, CSS or neither of both.[/color]
        >
        > And it still does not cover the scenario where a script error will cause
        > all scripts on the page to stop functioning. The NOSCRIPT element does
        > not cover that aspect.[/color]

        Hey! It isn't fair :-(
        ;-)
        We're discussing "no feature" downgrade issue. Runtime error script
        stability is a whole other issue.

        [color=blue]
        > It also does not cover a scenario as such in script enabled non-IE browsers:
        >
        > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
        > "http://www.w3.org/TR/REC-html40/strict.dtd">
        > <html>
        > <head>
        > <script type="text/vbscript">
        > Dim MyVar
        > MyVar = MsgBox ("Hello World!", 216, "MsgBox Example")
        > ' MyVar contains either 1 or 2, depending on which button is clicked.
        > </script>
        > </head>
        > <body>
        > <P>This is the body of the document</P>
        > <noscript>
        > <P>You have scripting disabled</P>
        > </noscript>
        > </body>
        > </html>
        >
        > Test that code in Opera or Firefox.[/color]

        I did not get that I guess. On both Opera 8.01 and FireFox 1.0.7 it
        ignores VBScript and shows "This is the body of the document" line only
        in the body. What's wrong with that?

        Comment

        • VK

          #49
          Re: A tag: href vs. onClick


          Randy Webb wrote:[color=blue]
          > VK said the following on 10/26/2005 1:43 PM:[color=green]
          > > Matt Silberstein wrote:
          > >[color=darkred]
          > >>So, instead of referencing #, should one put an anchor at the link and
          > >>reference that? That is, make the non-JavaScript link just go right
          > >>were it is?[/color]
          > >
          > >
          > > You just going right by middle 90's road. This is how first JavaScript
          > > programmers had to twist their minds. If you would *read my posts in
          > > this thread* you'll see the self-linked link mentioned. As it said
          > > where,
          > > <a href="#foo" name="foo"> trick is not usable neither for two reasons:
          > >
          > > 1) It crashes IE 3.x / IE 4.x which is not important anymore though[/color]
          >
          > Does this crash them:
          >
          > <a href="#foo">Lin k Text</a><a name="foo">
          >
          > ?[/color]

          Truthfully I don't remember anymore this issue because there was no
          need to overcome it, simply do not use it. It's like a taboo no one
          remembers anymore why: "Do not go to that cave!", "Do not use # for
          scripted links!" :-)

          [color=blue][color=green]
          > > 2) On a big page it still scrolls, so the self-linked link would be
          > > placed at the top of the page.[/color]
          >
          > Top of the page or top of the viewport? I think it would scroll to the
          > top of the viewport, instead of top of the page. I think that is what
          > you meant.[/color]

          I guess you right (see above). I just know that it moved the document,
          and it still moves it somehow: maybe not in that exact way as 8 years
          ago (the progress doesn't stay :-) but it moves it. So it's still
          should not be used.

          Comment

          • Randy Webb

            #50
            Re: A tag: href vs. onClick

            VK said the following on 10/26/2005 5:56 PM:[color=blue]
            > Randy Webb wrote:
            >[color=green][color=darkred]
            >>>VK said the following on 10/26/2005 1:27 PM:
            >>>1) Use a neutral tag to imitate link behavior. <noscript> and
            >>>conditiona l comments should be used to provide all necessary info to
            >>>customers w/o JavaScript, CSS or neither of both.[/color]
            >>
            >>And it still does not cover the scenario where a script error will cause
            >>all scripts on the page to stop functioning. The NOSCRIPT element does
            >>not cover that aspect.[/color]
            >
            >
            > Hey! It isn't fair :-(
            > ;-)
            > We're discussing "no feature" downgrade issue. Runtime error script
            > stability is a whole other issue.
            >
            >
            >[color=green]
            >>It also does not cover a scenario as such in script enabled non-IE browsers:
            >>
            >><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
            >>"http://www.w3.org/TR/REC-html40/strict.dtd">
            >><html>
            >><head>
            >><script type="text/vbscript">
            >>Dim MyVar
            >>MyVar = MsgBox ("Hello World!", 216, "MsgBox Example")
            >> ' MyVar contains either 1 or 2, depending on which button is clicked.
            >></script>
            >></head>
            >><body>
            >> <P>This is the body of the document</P>
            >><noscript>
            >> <P>You have scripting disabled</P>
            >></noscript>
            >></body>
            >></html>
            >>
            >>Test that code in Opera or Firefox.[/color]
            >
            >
            > I did not get that I guess. On both Opera 8.01 and FireFox 1.0.7 it
            > ignores VBScript and shows "This is the body of the document" line only
            > in the body. What's wrong with that?
            >[/color]

            It does not support the script. So, in theory, it should show the
            noscript element but it doesn't.

            --
            Randy
            comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
            Answer:It destroys the order of the conversation
            Question: Why?
            Answer: Top-Posting.
            Question: Whats the most annoying thing on Usenet?

            Please quote what you are replying to.

            If you want to post a followup via groups.google.c om, don't use the
            "Reply" link at the bottom of the article. Click on "show options" at
            the top of the article, then click on the "Reply" at the bottom of the
            article headers.

            Comment

            • VK

              #51
              Re: A tag: href vs. onClick

              > >>VK said the following on 10/26/2005 5:56 PM:[color=blue][color=green][color=darkred]
              > >><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
              > >>"http://www.w3.org/TR/REC-html40/strict.dtd">
              > >><html>
              > >><head>
              > >><script type="text/vbscript">
              > >>Dim MyVar
              > >>MyVar = MsgBox ("Hello World!", 216, "MsgBox Example")
              > >> ' MyVar contains either 1 or 2, depending on which button is clicked.
              > >></script>
              > >></head>
              > >><body>
              > >> <P>This is the body of the document</P>
              > >><noscript>
              > >> <P>You have scripting disabled</P>
              > >></noscript>
              > >></body>
              > >></html>
              > >>[/color]
              > >
              > > I did not get that I guess. On both Opera 8.01 and FireFox 1.0.7 it
              > > ignores VBScript and shows "This is the body of the document" line only
              > > in the body. What's wrong with that?
              > >[/color]
              > Randy Webb wrote:
              >
              > It does not support the script. So, in theory, it should show the
              > noscript element but it doesn't.[/color]


              But it does support *the* script! Try <body onload="alert(' I support
              scripting')">

              It simply ignores fragment of unknown Content-Type "text/vbscript"
              which seems right to me (?)

              If VBScript was a part of common Web standards we would expect 3
              separate tags from W3C like:
              <NOJSSCRIPT>
              <NOVBSCRIPT>
              <NOANYSCRIPT>
              Otherwise single <NOSCRIPT> is sufficient (?)

              If anyone puts her nose out of the ASP box to the client-side, it's her
              duty to provide a roll-back for standard browser users.

              <script type="text/vbscript">
              // Code
              </script>
              <script type="text/javascript">
              // Warning message if VBScript
              // was not executed
              </script>


              P.S. Ave we advocation VBScript ? ;-)

              Comment

              • VK

                #52
                Re: A tag: href vs. onClick


                VK wrote:[color=blue]
                > P.S. Ave we advocation VBScript ?[/color]

                Wow! Lesser beer - more sport! ;-)

                P.S. Are we advocating VBScript?

                Comment

                • VK

                  #53
                  Re: A tag: href vs. onClick

                  Formally thinking over the "VBScript is here but JavaScript is not"
                  issue we should insist on proper META-EQUIV declaration for used
                  language as suggested by W3C:
                  <http://www.w3.org/TR/REC-html40/interact/scripts.html#h-18.2.2.1>
                  (that was not nice of you to force me to go into Triple-W docs :-)

                  Naturally it still fails if a language cocktail (VBScript/JScript) is
                  used on the same page. But in case of VBScript-only it would prevent
                  script error in the sample below *if it was implemented by anyone*. But
                  neither of browsers I know of (including FireFox) doesn't respect this
                  content header.

                  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
                  <html>
                  <head>
                  <title>Testcase </title>
                  <meta http-equiv="Content-Type" content="text/html;
                  charset=iso-8859-1">
                  <meta http-equiv="Content-Script-Type" content="text/vbscript">
                  <style type="text/css">
                  <!--
                  body { background-color: #FFFFFF}
                  -->
                  </style>

                  <script>
                  Function vbsFunction()
                  Dim Foo
                  Foo = MsgBox("VBScrip t Message Box",64,"Test" )
                  End Function
                  </script>
                  </head>

                  <body onload="vbsFunc tion()">
                  <p>No content</p>
                  </body>
                  </html>

                  Comment

                  • Thomas 'PointedEars' Lahn

                    #54
                    Re: A tag: href vs. onClick

                    VK wrote:
                    [color=blue]
                    > Formally thinking over the "VBScript is here but JavaScript is not"
                    > issue we should insist on proper META-EQUIV declaration for used
                    > language as suggested by W3C:
                    > <http://www.w3.org/TR/REC-html40/interact/scripts.html#h-18.2.2.1>
                    > (that was not nice of you to force me to go into Triple-W docs :-)[/color]

                    The MS script engine, which is to my knowledge the only one to support
                    client-side VBScript, ignores the proper default scripting language
                    declaration via `meta' element. Instead, it selects the scripting
                    language in event handler attribute values based on the previously
                    selected scripting language or a label at the beginning of the event
                    handler attribute value.
                    [color=blue]
                    > Naturally it still fails if a language cocktail (VBScript/JScript) is
                    > used on the same page. But in case of VBScript-only it would prevent
                    > script error in the sample below *if it was implemented by anyone*. But
                    > neither of browsers I know of (including FireFox) doesn't respect this
                    > content header.
                    >
                    > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">[/color]

                    To not let Quirks/Compatibility Mode be used by UAs with DOCTYPE switch
                    feature, a proper system identifier (DTD URL) is missing here.
                    [color=blue]
                    > [...]
                    > <style type="text/css">
                    > <!--[/color]

                    Trying to comment out the contents of `style' and `script' elements for UAs
                    is an obsolete practice in HTML and error-prone in XHTML. Both elements
                    have already been defined in HTML 3.2 (even if only as placeholders), and
                    even older specified versions of HTML are (marked as) obsolete by RFC.


                    PointedEars

                    Comment

                    Working...