I have a page that has an iframe on it, and I let the user use the keyboard to select various movement styles. (right arrow key moves their character to the right) This great, but they have to actually focus on the iFrame by clicking on something. I've seen javascript that will focus on the iFrame but you need to click a link to actually focus in.
In summary, the problem is that they will be taken to another page at times, then will come back, but they can't move with the arrow keys until they click random white space in the iframe itself.
[solved] Focusing on an iFrame without hitting anything.
Moderator: General Moderators
-
Vael Victus
- Forum Newbie
- Posts: 24
- Joined: Wed Jun 03, 2009 9:29 am
[solved] Focusing on an iFrame without hitting anything.
Last edited by Vael Victus on Tue Jan 05, 2010 9:44 am, edited 1 time in total.
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: Focusing on an iFrame without hitting anything.
Probably several ways to do it. Here is one that might work. You can put it at the end of the page or in a function in the head and use an onload() in the body tag to call it.
Code: Select all
var fr = document.getElementById("myIframeID");
if (document.all) //IE
fr.document.body.focus();
else //Firefox
fr.contentDocument.body.focus();mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
-
Vael Victus
- Forum Newbie
- Posts: 24
- Joined: Wed Jun 03, 2009 9:29 am
Re: Focusing on an iFrame without hitting anything.
Perfect, thank you so much!