Style

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

    Style

    Lots of people say that

    a link (ie href="") should only ever point to another web page, not a
    javascript.
    a form button should only ever point to a server executable or a post
    method

    So what is a mutually acceptable trigger for something to activate a
    javascript? Or should we just ignore all those people trying to impose
    their own style on things?


    --
    --
    Fabian
    Visit my website often and for long periods!
    Sampaikan opini Anda secara bebas dan terbuka di AGAM69 WhichSideAreYouOn. Ikuti ruang jajak pendapat warga untuk melihat berbagai sudut pandang global.


  • Hywel Jenkins

    #2
    Re: Style

    In article <bo9b4s$1c5i4p$ 1@ID-174912.news.uni-berlin.de>,
    lajzar@hotmail. com says...[color=blue]
    > Lots of people say that
    >
    > a link (ie href="") should only ever point to another web page, not a
    > javascript.
    > a form button should only ever point to a server executable or a post
    > method
    >
    > So what is a mutually acceptable trigger for something to activate a
    > javascript? Or should we just ignore all those people trying to impose
    > their own style on things?[/color]

    What's wrong with the JavaScript events (on*)?

    --
    Hywel I do not eat quiche


    Comment

    • Lasse Reichstein Nielsen

      #3
      Re: Style

      "Fabian" <lajzar@hotmail .com> writes:
      [color=blue]
      > Lots of people say that
      >
      > a link (ie href="") should only ever point to another web page, not a
      > javascript.[/color]

      I concur. The typical behavior associated to a link is fetching the
      resource that the link points to. Typical labels of links are nouns
      or descriptions: "Cats", "Movies", "My links", "Rocket Science".
      [color=blue]
      > a form button should only ever point to a server executable or a post
      > method[/color]

      I disagree. Form controls can exist without a form, e.g., in DHTML
      applications. The behavior associated with a button is that clicking
      it makes something happen. Typical labels on buttons are verbs or
      actions: "Go!" "Activate", "Close window", "Energize".

      A good sign that using a link is misuse is that you don't know what
      to write in the href. Without a href, an <a>-element is no more special
      than a <span>. Adding, e.g., href="#" (a href that is never used anyway)
      is only to change how the element *looks*, which is really something one
      should do with CSS, not HTML.
      [color=blue]
      > So what is a mutually acceptable trigger for something to activate a
      > javascript?[/color]

      Unless the Javascript fetches a resource (you can write javascript
      that emulates a link perfectly), probably a button. Consider what
      you would write in the link/on the button.
      [color=blue]
      > Or should we just ignore all those people trying to impose
      > their own style on things?[/color]

      At your own peril. These rules describe what usability experts have
      found that people typically expect. Going against the users'
      expectations is rarely a smart move. It just makes the vote with their
      feet^H^H^H^Hbac k button.

      /L
      --
      Lasse Reichstein Nielsen - lrn@hotpop.com
      DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
      'Faith without judgement merely degrades the spirit divine.'

      Comment

      • Lee

        #4
        Re: Style

        Fabian said:[color=blue]
        >
        >Lots of people say that
        >
        >a link (ie href="") should only ever point to another web page, not a
        >javascript.
        >a form button should only ever point to a server executable or a post
        >method[/color]

        I don't believe you've heard lots of people say that second line.

        The "submit" type of button should only be used to hit the server,
        but other buttons were intended to invoke local code, via the
        onClick attribute.




        Comment

        • kaeli

          #5
          Re: Style

          In article <bo9b4s$1c5i4p$ 1@ID-174912.news.uni-berlin.de>,
          lajzar@hotmail. com enlightened us with...[color=blue]
          > Lots of people say that
          >
          > a link (ie href="") should only ever point to another web page, not a
          > javascript.[/color]

          Generally a good practice for browser compatibility. I've seen
          exceptions, but they're rare and usually involve non-internet
          applications.
          [color=blue]
          > a form button should only ever point to a server executable or a post
          > method[/color]

          I don't know that I would agree with that. For internet applications,
          maybe...but for everything else one can use HTML for, no way.
          [color=blue]
          > So what is a mutually acceptable trigger for something to activate a
          > javascript?[/color]

          An event (i.e. onClick) of any block element (i.e. table cells, divs,
          anchors...).

          <a href="SomeNonJS page.html" onClick="doSome thing();return false;">link
          text</a>

          This allows browsers that have script disabled to still have a
          functioning link. Use the link to point to a page that tells them they
          need script enabled. This does not work in NN4, which doesn't support
          onClick for A.

          <div onClick="whatev er()">Whatever</div>
          This works in most browsers, but not old ones. I *think* it doesn't work
          in NN4. 95% of people use IE5 and up. However, you should try to know
          your users. You might find out a lot of people come in with Opera or
          netscape 4. Site stats are a nice thing.
          [color=blue]
          > Or should we just ignore all those people trying to impose
          > their own style on things?[/color]

          There's a reason they say stuff - look into the reason and judge for
          yourself.


          -------------------------------------------------
          ~kaeli~
          Jesus saves, Allah protects, and Cthulhu
          thinks you'd make a nice sandwich.


          -------------------------------------------------

          Comment

          • Thomas 'PointedEars' Lahn

            #6
            Re: Style

            Hywel Jenkins wrote:
            [color=blue]
            > lajzar@hotmail. com says...[color=green]
            >> So what is a mutually acceptable trigger for something to activate a
            >> javascript? Or should we just ignore all those people trying to impose
            >> their own style on things?[/color]
            >
            > What's wrong with the JavaScript events (on*)?[/color]

            Events and event handlers are not restricted to
            JavaScript or other implementations of ECMAScript.
            They are part of (X)HTML and the DOM of the UA.


            PointedEars

            Comment

            Working...