Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

My onkeydown doenst work in a framed webpage

Posted on 2009-04-17
7
Medium Priority
?
525 Views
Last Modified: 2013-11-19
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
Comment
Question by:loopstudio
  • 6
7 Comments
 
LVL 19

Expert Comment

by:erikTsomik
ID: 24171204
can you post the code
0
 

Author Comment

by:loopstudio
ID: 24175560
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
 

Author Comment

by:loopstudio
ID: 24175567
Or maybe I should put my onkeydown recognition in a complete different place?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:loopstudio
ID: 24177520
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
 

Author Comment

by:loopstudio
ID: 24181036
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
 

Author Comment

by:loopstudio
ID: 24181059
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
 

Accepted Solution

by:
loopstudio earned 0 total points
ID: 24324667
I stop this issue. I have found out that its when using java-applets & Nobody is answering this thread.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question