Are all events supported in browser

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • connectwithme
    New Member
    • Sep 2007
    • 9

    Are all events supported in browser

    I am trying to attach a "onblur" event on the body element. IE does'nt throw any errors but the event is not captured by the browser when the onblur occurs on the elements withing the body.

    But if I attach a "onclick" event. That is captured by the browser.

    Any idea ?
  • pronerd
    Recognized Expert Contributor
    • Nov 2006
    • 392

    #2
    Originally posted by connectwithme
    I am trying to attach a "onblur" event on the body element.
    You would need to check the specific browsers DOM reference to see if that event is supported in the body tag. Even if it is how would that event ever be triggered? The entire page would some how have to lose focus.

    The only way I can think of for that to happen would be for you to have content outside of the body tags would would not follow correct syntax, and would risk not being rendered correctly.

    Comment

    • connectwithme
      New Member
      • Sep 2007
      • 9

      #3
      Originally posted by pronerd
      Even if it is how would that event ever be triggered? The entire page would some how have to lose focus.
      Isn't that the event propogation concept. ex.

      <div onClick="someFu nction()">
      <a href="www.a.com ">
      <a href="www.b.com ">
      </div>

      If I attach the onclick event to the div then every click on the href element will be captured

      Comment

      • mrhoo
        Contributor
        • Jun 2006
        • 428

        #4
        Not all events bubble- focus, blur, scroll, resize, and error do not, nor do most of the advanced events- mutation, textrange, treewalker.


        To get a complete list, get a good book or find a good tutorial.

        Comment

        • mrhoo
          Contributor
          • Jun 2006
          • 428

          #5
          Excuse me- I seem to have stuttered.
          Last edited by mrhoo; Apr 1 '08, 03:18 PM. Reason: repeated a post

          Comment

          • pronerd
            Recognized Expert Contributor
            • Nov 2006
            • 392

            #6
            Originally posted by connectwithme
            Isn't that the event propogation concept. ex.

            <div onClick="someFu nction()">
            <a href="www.a.com ">
            <a href="www.b.com ">
            </div>

            If I attach the onclick event to the div then every click on the href element will be captured
            This is exactly my point! Since all content in a properly formated HTML page goes inside the body tag, it does not matter what you click on or move the mouse to. The focused element(s) will always be inside the body tag so it should always contain the focused element.

            [HTML]
            <body onBlur="someFun tion()" >
            <span>Blah Blah Blah</span><br /><br /><br />
            <span>Blah Blah Blah</span><br /><br /><br />
            <span>Blah Blah Blah</span><br /><br /><br />
            <span>Blah Blah Blah</span><br /><br /><br />
            </body>
            [/HTML]

            Comment

            Working...