onmouseover / onmouseout not working as expected

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

    #1

    onmouseover / onmouseout not working as expected

    onmouseover and onmouseout seem only to work half the time in a script
    i wrote to fade between different opacities:



    (works in firefox, but not in internet explorer).

    also, the webpage doesn't validate because, i guess, the dns's used by
    the w3c validation services aren't up-to-date and still show a generic
    page.
  • Kae Verens

    #2
    Re: onmouseover / onmouseout not working as expected

    yawnmoth wrote:[color=blue]
    > onmouseover and onmouseout seem only to work half the time in a script
    > i wrote to fade between different opacities:
    >
    > http://www.frostjedi.com/terra/dev/test.html
    >
    > (works in firefox, but not in internet explorer).
    >
    > also, the webpage doesn't validate because, i guess, the dns's used by
    > the w3c validation services aren't up-to-date and still show a generic
    > page.[/color]

    the function relies on a value "object.sourceI ndex" to differentiate
    between the two different elements. this evaluates to "undefined" in
    firefox 1.0.

    Kae

    Comment

    • Michael Winter

      #3
      Re: onmouseover / onmouseout not working as expected

      On 5 Dec 2004 18:54:28 -0800, yawnmoth <terra1024@yaho o.com> wrote:
      [color=blue]
      > onmouseover and onmouseout seem only to work half the time in a script i
      > wrote to fade between different opacities:
      >
      > http://www.frostjedi.com/terra/dev/test.html
      >
      > (works in firefox, but not in internet explorer).[/color]

      I believe it's a bug. Simple as that. I made my own version of your script
      (which "works"[1] in all browsers, by the way) and noticed that when the
      opacity level reaches 100%, there is a brief flicker (though it doesn't
      happen in IE). If the maximum value is reduced to 99%, this flicker
      doesn't occur and the mouseout event fires normally.

      On the demo page at
      <URL:http://www.mlwinter.pw p.blueyonder.co .uk/clj/yawnmoth/fade.html>, the
      W3C image will go to 100% and the Firefox image to 99% (I've commented out
      the line which limits the maximum to 99 for this test). Hopefully you'll
      observe the difference.

      To address the issue Kae mentioned (which I also noticed), the script uses
      a hash table using the object references as the key and timer id as the
      value.
      [color=blue]
      > also, the webpage doesn't validate because, i guess, the dns's used by
      > the w3c validation services aren't up-to-date and still show a generic
      > page.[/color]

      It does now. In any case, the mark-up I used is Strict. You should note
      that all modern pages should be written to the Strict DTD. The
      Transitional DTD was only a temporary measure so that legacy pages could
      be considered valid[2].

      Mike


      [1] Meaning: does something sensible. If the techniques attempted are
      supported you'll have your fading images. If not, nothing visible will
      happen and there will be no errors. Currently, IE6 and Gecko-based
      browsers perform the fade.

      [2] That's my hypothesis but I've seen others in HTML groups share the
      same view.

      --
      Michael Winter
      Replace ".invalid" with ".uk" to reply by e-mail.

      Comment

      • yawnmoth

        #4
        Re: onmouseover / onmouseout not working as expected


        Michael Winter wrote:[color=blue]
        > On 5 Dec 2004 18:54:28 -0800, yawnmoth <terra1024@yaho o.com> wrote:
        >
        > <snip>
        >
        > I believe it's a bug. Simple as that. I made my own version of your[/color]
        script[color=blue]
        > (which "works"[1] in all browsers, by the way) and noticed that when[/color]
        the[color=blue]
        > opacity level reaches 100%, there is a brief flicker (though it[/color]
        doesn't[color=blue]
        > happen in IE). If the maximum value is reduced to 99%, this flicker
        > doesn't occur and the mouseout event fires normally.
        >
        > On the demo page at
        >[/color]
        <URL:http://www.mlwinter.pw p.blueyonder.co .uk/clj/yawnmoth/fade.html>,
        the[color=blue]
        > W3C image will go to 100% and the Firefox image to 99% (I've[/color]
        commented out[color=blue]
        > the line which limits the maximum to 99 for this test). Hopefully[/color]
        you'll[color=blue]
        > observe the difference.
        >
        > To address the issue Kae mentioned (which I also noticed), the script[/color]
        uses[color=blue]
        > a hash table using the object references as the key and timer id as[/color]
        the[color=blue]
        > value.
        >
        > <snip>
        >
        > It does now. In any case, the mark-up I used is Strict. You should[/color]
        note[color=blue]
        > that all modern pages should be written to the Strict DTD. The
        > Transitional DTD was only a temporary measure so that legacy pages[/color]
        could[color=blue]
        > be considered valid[2].
        >
        > Mike
        >
        >
        > [1] Meaning: does something sensible. If the techniques attempted are[/color]
        [color=blue]
        > supported you'll have your fading images. If not, nothing visible[/color]
        will[color=blue]
        > happen and there will be no errors. Currently, IE6 and Gecko-based
        > browsers perform the fade.
        >
        > [2] That's my hypothesis but I've seen others in HTML groups share[/color]
        the[color=blue]
        > same view.[/color]

        Wow - that was a great post! Thanks! :D

        I haven't yet looked at the code in as thorough detail as I'd like to,
        but based on what I have seen, support for more browsers should be
        do'able by adding the CSS attributes -moz-opacity and -khtml-opacity.
        Unfortunately, doing this will prevent the CSS from validating (I
        noticed you used IE's commenting system to prevent that part of the CSS
        from being validated), but short of defining them in an onload
        function, or something, I'm not sure what can really be done about
        that. Anyway, adding support for those should be easy enough, if I
        decide to do it :)

        With regard to Strict vs. Transitional - the webpage I intend on using
        this script on is XHTML 1.1 compliant (which, I think, is Strict by
        default), but I hadn't considered doing it for the testpage. I'll keep
        that in mind for future posts. Thanks! :)

        Comment

        • Michael Winter

          #5
          Re: onmouseover / onmouseout not working as expected

          On 7 Dec 2004 14:06:40 -0800, yawnmoth <terra1024@yaho o.com> wrote:

          [snip]
          [color=blue]
          > Wow - that was a great post! Thanks! :D[/color]

          You're welcome. It was interesting.
          [color=blue]
          > I haven't yet looked at the code in as thorough detail as I'd like to,
          > but based on what I have seen, support for more browsers should be
          > do'able by adding the CSS attributes -moz-opacity and -khtml-opacity.[/color]

          It is, but it will also require script changes: changing the opacity
          property won't have any effect on either of the other two. So, I've
          modified the script to determine which property is actually in effect.
          It's not been used on the demo page, but you can download it from
          <URL:http://www.mlwinter.pw p.blueyonder.co .uk/clj/yawnmoth/fade-new.js>.
          Testing shows that all versions from Mozilla 1.0 onwards now fade but
          unfortunately, earlier versions still exhibit the original sticking
          problem.

          I've added a few more comments to the new version, but if you have any
          questions, just ask.
          [color=blue]
          > Unfortunately, doing this will prevent the CSS from validating[/color]

          I don't think CSS validation is as important as mark-up validation. As
          long as the syntax is correct and the errors are only due to unrecognised
          properties (which will be ignored), then everything should be fine.
          [color=blue]
          > (I noticed you used IE's commenting system to prevent that part of the
          > CSS from being validated),[/color]

          IE's filters might be treated as more than just an unrecognised property
          name. The validator certainly thinks so.
          [color=blue]
          > but short of defining them in an onload function, or something, I'm not
          > sure what can really be done about that.[/color]

          Not much, if anything.
          [color=blue]
          > Anyway, adding support for those should be easy enough, if I decide to
          > do it :)[/color]

          Well, yeah. I did it for you! :P
          [color=blue]
          > With regard to Strict vs. Transitional [...] I hadn't considered doing
          > it for the testpage. I'll keep that in mind for future posts. Thanks!
          > :)[/color]

          It's not a big deal for test pages. I thought you intended to use
          Transitional mark-up on a production page; lots of people do. However,
          there's no harm in writing to a Strict DTD for both.

          Good luck with this,
          Mike

          --
          Michael Winter
          Replace ".invalid" with ".uk" to reply by e-mail.

          Comment

          • yawnmoth

            #6
            Re: onmouseover / onmouseout not working as expected


            Michael Winter wrote:[color=blue]
            > On 7 Dec 2004 14:06:40 -0800, yawnmoth <terra1024@yaho o.com> wrote:
            >
            > [snip]
            >
            > Well, yeah. I did it for you! :P[/color]

            And you probably did a better job than I could have done on my own,
            heh.

            Anyway, I've learned a bit from your code, already, so hopefully next
            time I won't need to ask for help (or if I do, it won't be as much help
            as I would have otherwise needed) :)
            [color=blue]
            > Good luck with this,[/color]

            Thanks! :)

            Comment

            Working...