2009/10/2 Stucture_Ulf <[email protected]>:
>
> hello and thanks for your answer!
>
> here's an extract from the script I'm using
>
> Event.observe(document, 'keypress', function(event) {
>  if(event.keyCode==8 ){
>     //content here
>  }
>  if(event.keyCode==0 ){
>     //content here
>  }
> });
>
> I tried to change from Event.observe(document to window but this has
> no effect. I can catch the event .keycode from the space bar, it is
> 0...But I do not now how to prevent the browser from scrolling down
> the page when space bar is pressed.
>
> On Oct 1, 12:32 am, "Miguel Beltran R." <[email protected]> wrote:
>> 2009/9/30 Stucture_Ulf <[email protected]>
>>
>>
>>
>> > I'm using an event observe to catch keystrokes and to add entered
>> > characters to a certain div. but i have a problem with the space bar
>> > button that causing a jump scroll on the page. looks like this is a
>> > browser function, is it possible to catch and prevent? would be
>> > grateful for any tips on how to stop this.
>>
>> > maybe add the observe to "window" or "document", but how say if the div
>>
>> have the focus?
> >
>

if(event.keyCode==0 ){
 event.stop();
}

should do the trick.
-- 
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to