473,242 Members | 1,461 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,242 software developers and data experts.

PgUp scrolling in FF

3
Hi,

I found following problem in FF 3.0.9 (it looks it is FF problem only). See few lines of code below:

Expand|Select|Wrap|Line Numbers
  1. <html>
  2.    <head>
  3.        <title>TEST</title>
  4.        <script type="text/javascript">
  5.            function act() {
  6.                document.getElementById('p_id').innerHTML = '';
  7.            }
  8.        </script>
  9.    </head>
  10.    <body style="padding: 400px;">
  11.        <p id="p_id"><input type="text" id="text" onkeypress="javascript: act();" /></p>
  12.        <a href="javascript://" onclick="javascript: act();">remove by click</a>
  13.    </body>
  14. </html>

There is function act() that clear content of P element. To reproduce problem start with click on link "remove by click". After click you can try use PgUp and PgDown keys. You can see that
scrolling of page works without problem. Then refresh page and insert cursor in the text field and try type anything.
After first press, handler is executed and content of P is deleted (same function act()). !!Only difference is that scolling
through PgUp and PgDown keys does not work after this action!!. This problem is in FF only (tested IE6,IE7, Opera).

This is only model. I use similar function to change value in table cell and in keydown handler catch ENTER.
Then I save data through AJAX to database ..after response is cell replaced by new value (but scrolling doesnt work).

Is it firefox internal problem? Any idea how to make scrolling works in FF after keypress?

Thanks

Rosta
Apr 29 '09 #1
4 1886
pronerd
392 Expert 256MB
Ok,

I think I see what is going on here. Once you select the text input field the field then absorbs all keyboard events. So if you change the trigger event from something like onkey to onmouseover the act() function is called before the text field is selected. And your keyboard events are not swallowed by the text field. Once a text field is selected though the keyboard events are swallowed by the text field, and you have to select something else on the page before events will work on the page again.


Expand|Select|Wrap|Line Numbers
  1. <html>
  2.    <head>
  3.        <title>TEST</title>
  4.        <script type="text/javascript">
  5.            function act() {
  6.                document.getElementById('p_id').style.display='none';
  7.                document.getElementById('p_id').focus();
  8.            }
  9.        </script>
  10.    </head>
  11.    <body style="padding: 400px;">
  12.           <form >
  13.            <p id="p_id" ><input type="test" id="inputOne" onmouseover="javascript: act(); return false;" /></p>
  14.         <input type="test" id="inputTwo" />
  15.         <a id="link" href="javascript://" onclick="javascript: act();">remove by click</a>
  16.        </form>
  17.    </body>
  18. </html>
  19.  
Apr 29 '09 #2
rosta
3
Im able trigger event with onmouseover..this is ok, but then have to add
some onkey handler that check what I typed in field (in real situation there can be fields for example
with validators) and in case of ENTER I delete field (with innerHTML = '' (or html('')..Im using jQuery ))
and scrolling stop work. Even if I set focus back to page then scrolling is out. See
my original code with focus to newfield in the end of act function, I tried other
things like select text or click on checkbox to revive page but nothing works.

Expand|Select|Wrap|Line Numbers
  1. <html>
  2.     <head>
  3.         <title>TEST</title>
  4.         <script type="text/javascript">
  5.             function act() {
  6.                 document.getElementById('p_id').innerHTML = '';
  7.                 //document.getElementById('newfield2').focus();
  8.                 document.getElementById('newfield1').click();
  9.                 document.getElementById('newfield1').focus();
  10.             }
  11.         </script>
  12.     </head>
  13.     <body style="padding: 400px;">
  14.         <input type="checkbox" id="newfield1" />
  15.         <input type="text" id="newfield2" />
  16.         <p id="p_id"><input type="text" id="text" onkeypress="javascript: act();" /></p>
  17.         <a href="javascript://" onclick="javascript: act();">remove by click</a>
  18.     </body>
  19. </html>
Apr 29 '09 #3
pronerd
392 Expert 256MB
@rosta
And as I already explained that is going to happen each time the user selects an input field. None of the key events are going to trigger until the user has selected something else.

Why does it matter if the user can use the page up or down buttons any way. If they have selected a textfield that they are entering data, why would they want to move off of the page. They would not be able to see what they are entering.
Apr 29 '09 #4
rosta
3
For now, I want only that user is able to scroll with PgUp PgDown after field edit...Please look at my last post carefully where in last steps of act() function I write this:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById('newfield1').click();
  2. document.getElementById('newfield1').focus();
this select other element on page according your "None of the key events are going to trigger until the user has selected something else" ;) ...but scrolling still doesnt work...try to test (in FF and then in other browsers) ;)

Looking forward your answer

Rosta
Apr 29 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Midas NDT Sales | last post by:
I have been looking at a simple example of a scrolling text box (the one in the SAM book) as below: <script language="JavaScript"> var pos=100; function Scroll() { if...
0
by: Filips Benoit | last post by:
Dear All, A2K Win2K MasterForm having 6 subforms total = 3 pages. If cursor stays in master PGUP and PGDN works OK but if the cursor is in a subform the PGUP and PGDN only affects the...
9
by: Miky | last post by:
Hi, I need to send Ctrl-PgUp (or Ctrl-PgDown) to the active application but when I use SendKeys.Send("^{PGUP}"), the program understands it as just PageUp. How may I solve it? Thanks in...
5
by: Ed Bitzer | last post by:
Would like to use PgUp and PgDn from a Form event. Have successfully been able to use the Enter key as an event unique event from a textbox using the boxes KeyChar event and e.KeyChar =...
2
by: P2P | last post by:
Hi I am wondering if someone know of a free cross-browsers vertical scrolling script that - is cross cross-browsers - will call the scrolling content from an external html page or from a...
5
by: PythonistL | last post by:
I am a newbie with Javascript. I have this simple script for scrolling text <HTML> <HEAD> <TITLE>Scrolling Message Script</TITLE> <SCRIPT language="JavaScript"><!-- var msg = 'My scrolling...
3
by: Matuag | last post by:
Hi All, How Can I disable PgUp and PgDown keys while in the Form view? Is there is any way to do this using GUI (no scripts) in Access 07? Matuag.
3
by: Chamnap | last post by:
Hello everybody, I have one problem. I want to do something after the user finished scrolling. The scroll event fires whenever the user is scrolling. I don't want this actually. Does anyone has...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.