I am trying to create a javascript function that will collect data from text fields in a form on the same page and assign it to variables defined in the function, which will then be used elsewhere in the function to affect the result of user actions.
Specifically, I want the user to be able to control the size of the browser window by clicking left, right, up, and down arrows. I have accomplished this already by using the following script:
function resizeMe(deltaX,deltaY) {
window.resizeBy(deltaX,deltaY);
}
and calling the script like this:
...
It works beautifully, but what I would like to do is have the user be able to enter the number of pixels themselves in a simple form, thus being able to control the size more precisely. When the user clicks the "Submit" button, I would like the values entered in the input text fields of the form to be assigned to variables in the function that would then be passed to the "deltaX" and "deltaY" params. When the user then clicks on the right, left, up, or down arrows, the window would resize by the increment defined by "deltaX" and "deltaY".
Is this too complicated? Can you just set the values of "deltaX" and "deltaY" directly from the form action?
I'm not sure how feasible this feature would be to implement on a page, whether it would enhance the browsing experience or not, but I'd still like to have the script. It just stems from all of the comments in this forum about how nobody likes having someone else take control of their browser. I thought this might be a nice compromise: the designer who wants artistic control over how the page looks can pop the page open to full screen or whatever when it's loaded, and the user who can't stand having their browser fill their screen can use this feature to control the resize. I realize that not disabling the resize handles would let them do this anyway, but this would just be another way to let the user know that you care about their experience enough to go to the trouble of creating this nice interface for them ;) It basically says you're thinking about them; that you're not too caught up in yourself and your design skills. Just another way to affect your visitors in a subconscious way...
Submit Your Article
Forum Rules

Reply With Quote
