By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,916 Members | 1,068 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,916 IT Pros & Developers. It's quick & easy.

Detecting if onscroll events working / supported in Firefox

P: n/a
Is there a way to detect if an textarea onscroll event is working in
Firefox (or Mozilla). I know that there is an onscroll event bubbling
bug with current vesions of these browsers so I want to detect this
problem with a test like "if (textarea.onscroll == 'undefined' ||
!textarea.onscroll) {}." Any help would be appreciated.

Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

Mark Szlazak wrote:
Is there a way to detect if an textarea onscroll event is working in
Firefox (or Mozilla). I know that there is an onscroll event bubbling
bug with current vesions of these browsers so I want to detect this
problem with a test like "if (textarea.onscroll == 'undefined' ||
!textarea.onscroll) {}." Any help would be appreciated.


I've tried the following code and it seems to work in IE and Firefox on
a Win2k box. Does anyone see problems with it as a test used for
branching to workaround code when a buggy Moz/Firefox browser is being
used?

<html>
<head>
<script>
function isBubbling (ta) {
var bubbling = false, str = '';

ta.onscroll = function () { bubbling = true; }

for (var i=0; i<ta.rows; i++) str += '\n';
ta.value = str;
ta.scrollTop = ta.scrollHeight;
ta.scrollTop = 0;

ta.value = "";
return bubbling;
}

onload = function ()
{
var ta = document.getElementById('ta');

if (isBubbling(ta))
{
alert('bubbling');
}
else
{
alert('not bubbling');
}
}
</script>
</head>
<body>
<textarea id="ta" rows=5 cols=40></textarea>
</body>
</html>

Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.