Do You Think This Is Possible?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Prisoner at War

    Do You Think This Is Possible?


    Hi, Folks!

    Do y'all think it's possible to use JavaScript to alternate the text
    of the ALT attribute of an <imgtag?

    And is there a way to have that ALT's text show up in Opera and
    Firefox the way it does in Internet Explorer?

    So that with an onMouseOver it will appear as if the image of a dog,
    for example, is saying, alternately, "moo," "meow," "a little to the
    left," and "ah, that hits the spot"?

    BTW, I read somewhere that Opera is the most JavaScript (ECMAScript or
    something) compliant browser there is. True?


    As always, many thanks for all your time and help!
  • Joost Diepenmaat

    #2
    Re: Do You Think This Is Possible?

    Prisoner at War <prisoner_at_wa r@yahoo.comwrit es:
    Hi, Folks!
    >
    Do y'all think it's possible to use JavaScript to alternate the text
    of the ALT attribute of an <imgtag?
    Yes. But really; don't.
    And is there a way to have that ALT's text show up in Opera and
    Firefox the way it does in Internet Explorer?
    If any browser still does that, it's very old behaviour that's widely
    regarded as wrong. You should use TITLE instead.
    So that with an onMouseOver it will appear as if the image of a dog,
    for example, is saying, alternately, "moo," "meow," "a little to the
    left," and "ah, that hits the spot"?
    That's very much not what a title attribute is supposed to be used for,
    so you probably shouldn't expect it to work everywhere. Why don't you
    try it and see if it does.
    BTW, I read somewhere that Opera is the most JavaScript (ECMAScript or
    something) compliant browser there is. True?
    Dunno. In practice the implementations of the ecma 262 standard in the
    "big" browsers (mozzilas, ie, opera, safari and deriviates) are all
    pretty much complete - the only thing I can think of right now is that
    IE won't allow the elements in an array literal to be ended with a
    comma.
    As always, many thanks for all your time and help!
    --
    Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/

    Comment

    • Thomas 'PointedEars' Lahn

      #3
      Re: Do You Think This Is Possible?

      Joost Diepenmaat wrote:
      Prisoner at War <prisoner_at_wa r@yahoo.comwrit es:
      >Do y'all think it's possible to use JavaScript to alternate the text
      >of the ALT attribute of an <imgtag?
      >
      Yes. But really; don't.
      Whether that recommendation makes sense would depend on the task to be
      accomplished, of course. If images are to be switched so that the next
      image shows a different object than the previous image, it would not only
      be possible but prudent to change the `alt' attribute value as well, so that
      the alternative text changes for that image.

      This should be done as follows:

      imgRef.alt = "newValue";


      BTW, it's _Mozilla_.


      PointedEars
      --
      Prototype.js was written by people who don't know javascript for people
      who don't know javascript. People who don't know javascript are not
      the best source of advice on designing systems that use javascript.
      -- Richard Cornford, cljs, <f806at$ail$1$8 300dec7@news.de mon.co.uk>

      Comment

      Working...