IE7: onclick does not fire on scrollbar!

  • mk27
  • Proficient
  • Proficient
  • User avatar
  • Posts: 334

Post 3+ Months Ago

Okay, so I have been working on my chat site (thanks to the people who have helped me test it!). One complication is that the refresh necessary to maintain the content fouls stuff like cut n' paste up (that's somewhat solved). Also, it is necessary to "autoscroll" the content div at every refresh to keep the end of the dialogue in view:
Code: [ Select ]
function refresh(name) {
    if (!RefreshOn) {
    new Ajax.Updater(maindiv, 'text.comp?name='+name, {method: 'get',
        onSuccess: function (xhro) {
            if (<!-- !!\*\*NCHIADCLOSED\*\*!! -->/)>0) { return }
            if (document.msgin.ASchkb.checked) { setTimeout("maindiv.scrollTop=maindiv.scrollHeight",200) }
  1. function refresh(name) {
  2.     if (!RefreshOn) {
  3.         setTimeout("refresh('"+name+"')",2000);
  4.         return;
  5.     }
  6.     new Ajax.Updater(maindiv, 'text.comp?name='+name, {method: 'get',
  7.         onSuccess: function (xhro) {
  8.             if (<!-- !!\*\*NCHIADCLOSED\*\*!! -->/)>0) { return }
  9.             setTimeout("refresh('"+name+"')",2000);
  10.             if (document.msgin.ASchkb.checked) { setTimeout("maindiv.scrollTop=maindiv.scrollHeight",200) }
  11.         }
  12.     });
  13. }

The "autoscroll" control is determined at line 10, dependent on the state of a checkbox. This is to allow the user to turn autoscrolling off so they can roll back up the page.

Now, I would like to make this easier, so I set an onmousedown/onmouseup combination for the content div:
Code: [ Select ]
  1. onmousedown="document.msgin.ASchkb.checked=false;"
  2. onmouseup="document.msgin.ASchkb.checked=true;"

This would allow you to grab the scrollbar and roll up (if you let go of it, the autoscroll is back on). You know what I discovered? FF, no problem. In IE7, onmousedown fires, but testing onmouseup (and therefore, also, onclick) DOES NOT HAPPEN on the scrollbar.

Now, ha ha, I realized a few minutes later that the original strategy is a bad one, since if you turn the autoscroll off with the checkbox so you can roll back up and let go of the bar, the act of click and release of course turns the autoscroll back on. So forget that feature. BUT, for future reference, I was wondering if anyone knows of a workaround for this IE scrollbar "no click" issue?

Next, very related question: the partial answer to the cut n' paste dilemma was to turn the refresh off when the mouse is used in the content div. But I can't do it for any mouse action, because the scrollbar is part of it. So for now, I have to use double click. Does anyone know how to isolate the scrollbar from it's div?

Finally, third question: it seems to me the number of key codes usable by javascript is limited to the alphabet, I guess because most of the ctrl combos & F keys are reserved for the browser. As you can see, that means I need to disable hotkeys in the text area, since they are letters. Are there any other options I've missed here?

ps. don't forget to drop by!

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 16 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.