I write light wyswig(iframe). I have function who counted length in iframe when event keyup and change in box(for characters left) number of symbols. But in Opera 9.24 when i change innerHTML box browser drop me to top of html page.
//this.doc - iframe document
$(this.doc).keydown(function(e)
{
if (e.ctrlKey || e.metaKey) isCtrl = true;
if (e.keyCode == 9) { this.execCommand('indent', false); return false; }
if (e.keyCode == 66 && isCtrl) { this.execCommand('bold', 'bold'); return false; }`enter code here`
if (e.keyCode == 73 && isCtrl) { this.execCommand('italic', 'italic'); return false; }
}.bind2(this)).keyup(function(e)
{
isCtrl = false;
if (e.keyCode == 13)
{
return true;
}
if(this.opts.maxlength)
this.checkLength();
if(this.opts.autoSync)
this.syncCode();
}.bind2(this));
checkLength: function() {
var html = this.getHtml();
if (html.length >= this.opts.maxlength) {
html = html.substr(0, this.opts.maxlength );
this.setHtml(html);
alert('Комментарий должен содержать до ' + this.opts.maxlength);
} else {
var number = this.opts.maxlength - html.length;
//li_counter - box for characters left
this.li_counter.html("Осталось символов: " + number);
}
// bind2
Function.prototype.bind2 = function(object)
{
var method = this; var oldArguments = $.makeArray(arguments).slice(1);
return function (argument)
{
if (argument == new Object) { method = null; oldArguments = null; }
else if (method == null) throw "Attempt to invoke destructed method reference.";
else { var newArguments = $.makeArray(arguments); return method.apply(object, oldArguments.concat(newArguments)); }
};
};
},
Are you sure this.doc is the IFRAME document and not for some reason the parent document? Where is this.doc set?
BTW Opera 9.24 is quite old by now, and should not have many users. Is there any specific reason why you need to test on this outdated version?