Results 1 to 6 of 6

Thread: Javascript Keyboard Events In Iframe

  1. #1
    Join Date
    Nov 2009
    Posts
    1,340

    Javascript Keyboard Events In Iframe

    Hello, recently I am started to study the javascript. While making research on it I come to know that I can able to retrieve an event from the keyboard but it is not possible in iframe. That means I don't know the way to do it with the iframe. So, if anyone knows the code to perform it, then please provide me that.

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Javascript Keyboard Events In Iframe

    Hello, I have got this code if you want to make use of the Javascript keyboard event :
    Code:
    shortcut.add("Ctrl+B",function()
    {
    	alert("In the bookmark");
    },
    {
    	'type':'keydown',
    	'propagate':true,
    	'target':document
    });

  3. #3
    Join Date
    May 2008
    Posts
    2,297

    Re: Javascript Keyboard Events In Iframe

    See the code below which can make use of the javascript keyboard events in Iframe:
    Code:
    <html>
    <head>
    <script type ="text / javascript">
    
    function handler(ev)
    {
    if (document.all)
    ev = window.event;
    alert("char" + String.fromCharCode(ev.charCode) + "[" + E.charCode + "]");
    }
    document.onkeypress = KeyHandle;
    </ script>
    </ head>
    <body>
    <iframe height ="300" width ="300" id ="me" onkeypress ="KeyHandle (event)">
    </ iframe>
    </ body>
    </ html>

  4. #4
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Javascript Keyboard Events In Iframe

    Hello, I have come to know that you can simply make use of the code below to get the solution for your problem.
    Code:
    e = window.event;
    It will be used as window is the parent window.

  5. #5
    Join Date
    May 2008
    Posts
    2,389

    Re: Javascript Keyboard Events In Iframe

    I think for getting this you may need to link the event to the iframe. So for that you can make use of the code below. It can able to solve your problem. So, just make use of it and get the problem solved:

    Code:
    e = window.event | | Parent['nomiframe'].window.event;

  6. #6
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Javascript Keyboard Events In Iframe

    Hey, If you modify the code of the Zecho as below then you can able to get the solution for your problem:
    Code:
    <html>
    <head>
    <script type ="text / javascript">
    function Handle(evnethand)
    {
    if (document.all)
    evnethand = window.event | | Parent['I'].window.event; alert("char" + string.fromCharCode(evnethand.charCode) + "[" + E.charCode + "]");
    }
    document.onkeypress = Handle;
    </ script>
    </ head>
    <body>
    <iframe height ="400" width ="400" id ="me" name="me" onkeypress ="Handle (event)">
    </ iframe>
    </ body>
    </ html>

Similar Threads

  1. Why we use Events in JavaScript?
    By Samarth in forum Software Development
    Replies: 5
    Last Post: 30-01-2010, 09:15 PM
  2. Explain the Timing Events in JavaScript
    By Shaan12 in forum Software Development
    Replies: 5
    Last Post: 19-12-2009, 05:41 AM
  3. What are the different Events in the Javascript?
    By Sheena_thakkar in forum Software Development
    Replies: 5
    Last Post: 18-12-2009, 08:07 AM
  4. How to design javascript parent iframe
    By Nurhan in forum Software Development
    Replies: 3
    Last Post: 13-08-2009, 03:26 PM
  5. How to use Iframe tag in javascript
    By Walter89 in forum Software Development
    Replies: 3
    Last Post: 30-06-2009, 11:39 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,961,752.13617 seconds with 16 queries