Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Web and WebWorks Development

Reply
New Developer
aburt
Posts: 8
Registered: 11-22-2009

Onfocus not working? Or - how to detect position in a page?

Hi all, just got a 9700 and love it.  Best 'berry ever. :smileyhappy: 

 

I'm trying to port a web page that tracks your position within a lengthy page.  With OS 4.x the workaround I found was to place small form buttons here and there, and when the button came into view the HTML onFocus event would fire, and I'd know the browser was at position 'a', 'b', or whatnot.

 

OnFocus isn't working for any HTML element I try in OS 5.  (I have OS 5.0.0.330, trying this in the Internet Browser.)  I've tried onFocus on input buttons, IMG, A.  Nothing happens -- event never fires.  (I also tried onKeyPress and onKeyDown on BODY but that never fires either.)

 

Basically trying to track a position within the page, to know if we've arrived at point A, point B, C, etc.  (Which is then saved as a cookie so on returning to the page we're popped back to the last known position.  Essentially an in-page bookmark.)

 

Any thoughts on either why onFocus isn't firing, or alternative suggestions how to detect position within a lengthy page in OS 5?

 

Thanks.

Please use plain text.
Developer
Posts: 107
Registered: 09-25-2008

Re: Onfocus not working? Or - how to detect position in a page?

You can try window.scrollY and see if that works.

Please use plain text.
New Developer
aburt
Posts: 8
Registered: 11-22-2009

Re: Onfocus not working? Or - how to detect position in a page?

Hmm, that might work.  I've already got a regular timeout set on the page so every time it fires I could save out the current scrollY.  I'll play with that. 

 

(Still open to onFocus / onKeypress ideas...)

Please use plain text.