Hello,
I have an ASP.Net application where all my TextBox components contain the "onblur" and "onfocus" events.
The principle:
- I'd like to allow the text selection in the control (when focusing)
- I'd like to disable the text selection of my page when outside the control (on onblur)
So, I have this code on the onfocus event :
And this one on the onblur event :Code:function SetBodyDragOn(o) { document.body.onselectstart = new Function("return true;"); document.body.ondragstart = new Function("return true;"); document.body.onselect = new Function("return true;"); // Set an edit design class on the textbox control if (o) o.className = "InputEditingOn"; }
With all the browsers (even Firefox), it works fine during one moment.Code:function SetBodyDragOff(event, o) { if (typeof event.preventDefault != 'undefined') event.preventDefault(); document.body.onselectstart = new Function(" {event.returnValue=false; try { event.stopPropagation(); event.preventDefault() } catch (ex) {alert(ex.message)} return false; } "); document.body.ondragstart = new Function(" {event.returnValue=false; try { event.stopPropagation(); event.preventDefault() } catch (ex) {alert(ex.message)} return false; } "); document.body.onselect = new Function(" {event.returnValue=false; try { event.stopPropagation(); event.preventDefault() } catch (ex) {alert(ex.message)} return false; } "); // Set a standard design class on the textbox control if (o) o.className = "InputEditingOff"; }
After a certain time of using, on Firefox, the onblur is not fired.
The cursor stays in the control.
Why this behavior?
Why it works a certain time and not after (memory problem?)
To soluce the problem, I have to reboot my Firefox.
Thanks in advance,
Yannis.


Reply With Quote

Bookmarks