Disable scrolling on input focus in javascript?

You could possibly set the scrollTop property to x every n milliseconds. The problem with that approach I would think would be that the page would look jerky (technical term) when the user attempted to scroll the page Besides, you'd be breaking the expectations of the user that they be able to scroll the page at any time which I would recommend against as it could confuse them at best and annoy them at worst.

You could possibly set the scrollTop property to x every n milliseconds. The problem with that approach I would think would be that the page would look jerky (technical term) when the user attempted to scroll the page. Besides, you'd be breaking the expectations of the user that they be able to scroll the page at any time which I would recommend against as it could confuse them at best and annoy them at worst.

Yeah I though of this, but I would not look nice for the user. I was hoping to disable the browser function that automatically focuses the text field. – John Space Jan 4 '10 at 6:31.

So I figured out how to accomplish this, and I will leave this as a record for anyone else who needs to solve this problem. (NOTE : this solution has only been tested on safari and Firefox) for: the function document. GetElementById('text').

Onkeydown = new function(event){return false} Will not cause the window to shift the scroll so that a user can see the input field when he types into the field. If like me you want this to happen for some letters but not for others simply edit the contents of the onkeydown function so that it returns false for certain keycodes and true for others.

Bind an event handler to the “focus” JavaScript event, or trigger that event on an element. Selects element if it is currently focused. Bind an event handler to the “focusin” event.

Bind an event handler to the “focusout” JavaScript event. Retrieve the DOM elements matched by the jQuery object. Select all elements at an index greater than index within the matched set.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions