• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 536
  • Last Modified:

My onkeydown doenst work in a framed webpage

I have a window which will not recognise a onkeypressed event every time.
It seems maybe to be related to not having focus (in the right areas) or something when it opens.

My windows is filled with dynamic content in different frames & iframes.
I have now tried to put an alert() into all BODY-tags in all the (i)frames, in order to try find the problem.
But when the window opens the first time, its like NONE of the (i)frames are having focus or something, because NO alert-boxes pop up, before I explicit push left mouse key into one of the (i)frames and THEN press a key, e.g. [backspace] which is actually what I want to prevent from being possible in the whole window and (i)frames.
0
loopstudio
Asked:
loopstudio
  • 6
1 Solution
 
erikTsomikSystem Architect, CF programmer Commented:
can you post the code
0
 
loopstudioAuthor Commented:
unfortunately NO..

Im looking for somebody that either:
- have experience with what to do with preventing [backspace] in IE in a webpage consisting of frames
- have experiencing similar problems
- knows about problems with focus being somewhere else than in one of the BODY-tags. Maybe someone know which object normally receives focus first or last
- someone knows WHAT to do to allways ensure focus in the right place so that it can be catched by a "onkeydown"
- maybe someone can provide an example code that allways works

Additional info.. In some of the frames I have FLash-applets, in other I have Java-applets and in other again I have WMP-applet.
My thought is that either the WINDOW itself or one of the applets is steeling the focus, so that my onkeydown on all the body-tags doesnt catch it!
0
 
loopstudioAuthor Commented:
Or maybe I should put my onkeydown recognition in a complete different place?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
loopstudioAuthor Commented:
Maybe someone can tell me how to write a little code with an alertbox telling which element that receives focus?
I want the alertbox to be fired no matter where it happens within the window.

THAT could help me in order to find out what element is having the focus and therefore not firing the onkeydown event!
0
 
loopstudioAuthor Commented:
Maybe I should use an eventlistener?

Have tried something like this:

 <html>
 <head>
   <title>DOM Event Example</title>

   <script type="text/javascript">

   // Function to add event listener to t
   function load() {
    var b_var = document.getElementById("b");
      
       b_var.addEventListener('focus', f(), false);
   }

   function f() {
            return true
   }

   </script>

 </head>

 <body onload="load();">
 
 <table id="t">
   <tr><td id="t1">one</td></tr>
   <tr><td id="t2">two</td></tr>
 </table>
 
 <button id="b"></button>
 
 </body>
 </html>

But it says that object doesnt support this property or method.
0
 
loopstudioAuthor Commented:
I can read that the ONKEYDOWN supports <BODY>, <OBJECT>, <TABLE> and more HTML tags and document, image, link and textarea are supported JavaScript objects.

How can I write some code that catches onkeydown to all the above in a simple generic way?
0
 
loopstudioAuthor Commented:
I stop this issue. I have found out that its when using java-applets & Nobody is answering this thread.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now