The code below correctly sets an iframe to be editable, and then tries
to attach an "onkeyup" event to the iframe. Instead of doing that,
however, it generates a cryptic "Object required" error in Explorer 7,
and doesn't seem to do anything at all in Firefox. Am I missing
something really basic?
Thanks for any help.
--Brent
--------------------------------------------------------------------------
function makeEditable(el)
{
thisEl = el.contentWindow.document;
try
{
if(thisEl.body.contentEditable)
{thisEl.body.contentEditable = true;}
else
{thisEl.designMode = "on";}
}
catch(e)
{
alert(e);
}
thisEl.body.style.fontFamily = "verdana, arial, helvetica, sans-
serif";
thisEl.body.style.fontSize = "12px";
thisEl.body.style.margin = "1px";
thisEl.onkeyup = checkKeys; //<--doesn't seem to register the
event
}
function checkKeys(e)
{
var event = e ? e : window.event;
var KeyID = event.keyCode;
alert(KeyID);
} 3 3788
On Apr 23, 5:42 pm, Brent wrote:
... , it generates a cryptic "Object required" error in Explorer 7,
and doesn't seem to do anything at all in Firefox. Am I missing
something really basic?
Thanks for any help.
-------------------------------------------------------------------
function makeEditable(el)
{
thisEl = el.contentWindow.document;
<snip>
thisEl.onkeyup = checkKeys; // ...
}
function checkKeys(e)
{
var event = e ? e : window.event;
^^^^^^^^^^^^
var KeyID = event.keyCode;
<snip ^^^^^^^^^^^^^
In IE, you are assigning the keyup listener to the document in the
IFRAME (as you must) but the code in the assigned function is looking
for the event in the window that contains the IFRAME, which is not the
window in which the events are happening.
On Apr 23, 10:21*am, Henry <rcornf...@raindrop.co.ukwrote:
On Apr 23, 5:42 pm, Brent wrote:
... , it generates a cryptic "Object required" error in Explorer 7,
and doesn't seem to do anything at all in Firefox. Am I missing
something really basic?
Thanks for any help.
-------------------------------------------------------------------
function makeEditable(el)
{
* * thisEl = el.contentWindow.document;
<snip>
* * thisEl.onkeyup = checkKeys; // ...
}
function checkKeys(e)
{
* * var event = e ? e : window.event;
* * * * * * * * * * * * * ^^^^^^^^^^^^* * var KeyID = event.keyCode;
<snip* * * * * *^^^^^^^^^^^^^
In IE, you are assigning the keyup listener to the document in the
IFRAME (as you must) but the code in the assigned function is looking
for the event in the window that contains the IFRAME, which is not the
window in which the events are happening.- Hide quoted text -
- Show quoted text -
thisEl.document.body.onkeyup ?
On May 8, 4:42 am, Freeform wrote:
On Apr 23, 10:21 am, Henry wrote:
>On Apr 23, 5:42 pm, Brent wrote:
>>... , it generates a cryptic "Object required" error in Explorer 7, and doesn't seem to do anything at all in Firefox. Am I missing something really basic?
>>Thanks for any help. ----------------------------------------------------------------- function makeEditable(el) { thisEl = el.contentWindow.document;
<snip>
>> thisEl.onkeyup = checkKeys; // ...
>>}
>>function checkKeys(e) {
>> var event = e ? e : window.event;
> ^^^^^^^^^^^^
>> var KeyID = event.keyCode;
><snip ^^^^^^^^^^^^^
>In IE, you are assigning the keyup listener to the document in the IFRAME (as you must) but the code in the assigned function is looking for the event in the window that contains the IFRAME, which is not the window in which the events are happening.- Hide quoted text -
^^^^^^^^^^^^^^^^^^^^
>- Show quoted text -
^^^^^^^^^^^^^^^^^^^^
Why are you including meaningless text in your posts, and most
especially, why have you attributed that text to me?
thisEl.document.body.onkeyup ?
What (and why)? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Trent |
last post by:
Hi. I know the basic way to assign event handlers:
<input onKeyUp="processEvent(event)" />
But how do I assign a function to the onKeyUp event in *javascript*
that can access the event...
|
by: Evan Wong |
last post by:
I have problem to get onkeyup event. If we put the event in HTML
statement like -
"<input name=field1 size=16 onkeyup="javascript:function1();>"
it works.
If we put in JavaScript code like...
|
by: Brad |
last post by:
The first text on my form is a numeric field. I have a javascript that
runs on this field for onkeyup (validate the key strokes and modifies
fields on the screen) but when I do this and have the...
|
by: TS |
last post by:
I am creating a User control and i create some dynamic controls in the init
handler. one of the controls is a custom validator which i assign a
serverValidate event handler. I usally always do my...
|
by: John Kotuby |
last post by:
Hi guys,
I am converting a rather complicated database driven Web application from
classic ASP to ASP.NET 2.0 using VB 2005 as the programming language. The
original ASP application works quite...
|
by: mc |
last post by:
Can someone suggest how I would add a new trigger such that when the JS event onkeyup in a textbox
the updatePanel refreshes?
If not could someone sugest how I could onkepup in a Textbox, refresh...
|
by: manojsharma |
last post by:
hey can anybody tell me y my onkeyup event is not working in firefox.. it is working fine in IE... code
<input type="text" name="oddteam" size="1" value="1" ...
|
by: Tony Johansson |
last post by:
Hello!
I wonder can somebody explain when is it suitable to
use these methods
OnKeyUp, OnKeyDown and OnKeyPress
because these raise an event. These are located in class UserControl.
If these...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |