473,396 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to check if a property is writable?

mav
To stop the keyboard event for the F4-key from propagating in IE I need
to set event.keyCode to 0. But setting keyCode to 0 in Mozilla/Firefox
will throw an exception since it is a read-only property.

So, how do I check if event.keyCode is writable?

(I could do some check to see if the script is run in IE or add a
try/catch for Mozilla, but I would like to know the 'correct' method)

Thanks, MAV

Jan 17 '06 #1
6 2951
mav said the following on 1/17/2006 7:18 AM:
To stop the keyboard event for the F4-key from propagating in IE I need
to set event.keyCode to 0. But setting keyCode to 0 in Mozilla/Firefox
will throw an exception since it is a read-only property. So, how do I check if event.keyCode is writable?


You don't. You cancel propogation and return false from the onkey* event
handler.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 17 '06 #2
mav
I completely agree, but this doesn't work for certain keys (e.g. F4).
AFAIK the only way to cancel the F4 key in IE is to set keyCode to 0.

Jan 17 '06 #3
mav said the following on 1/17/2006 8:01 AM:

Please quote what you are replying to.

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers.
I completely agree, but this doesn't work for certain keys (e.g. F4).
AFAIK the only way to cancel the F4 key in IE is to set keyCode to 0.


Why are you trying to redefine my keyboard?
F4 in IE shows me my Address Bar drop-down.
F4 in Mozilla does nothing for me.
So I don't see where trying to cancel F4 does any good unless it does
something different that I am not seeing (I opened both and hit F4 to
see what the key does).

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 17 '06 #4
mav

Randy Webb schreef:
Why are you trying to redefine my keyboard?
F4 in IE shows me my Address Bar drop-down.
F4 in Mozilla does nothing for me.
So I don't see where trying to cancel F4 does any good unless it does
something different that I am not seeing (I opened both and hit F4 to
see what the key does).


Our customer specifically requested the use of the F4 key to submit
pages (to make the transition from the legacy application easier).
So I need to catch the F4-key in the (on)keydown, submit the form and
cancel the default action.

Jan 17 '06 #5
mav wrote:
Randy Webb schreef:

Why are you trying to redefine my keyboard?
F4 in IE shows me my Address Bar drop-down.
F4 in Mozilla does nothing for me.
So I don't see where trying to cancel F4 does any good unless it does
something different that I am not seeing (I opened both and hit F4 to
see what the key does).

Our customer specifically requested the use of the F4 key to submit
pages (to make the transition from the legacy application easier).
So I need to catch the F4-key in the (on)keydown, submit the form and
cancel the default action.


Since there Mozilla doesn't appear to have default action defined for
the F4 key, there's nothing to cancel. ;-)
There's a discussion here that may help:

<URL:
http://groups.google.com/group/comp....2df56c39040975

--
Rob
Jan 17 '06 #6
mav said the following on 1/17/2006 8:52 AM:
Randy Webb schreef:

Why are you trying to redefine my keyboard?
F4 in IE shows me my Address Bar drop-down.
F4 in Mozilla does nothing for me.
So I don't see where trying to cancel F4 does any good unless it does
something different that I am not seeing (I opened both and hit F4 to
see what the key does).

Our customer specifically requested the use of the F4 key to submit
pages (to make the transition from the legacy application easier).


Maybe you need to educate your customer on the futility of it then.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 17 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

43
by: Steven T. Hatton | last post by:
Now that I have a better grasp of the scope and capabilities of the C++ Standard Library, I understand that products such as Qt actually provide much of the same functionality through their own...
2
by: Amith | last post by:
Hi, I am using an ActiveX created using delphi. It has a font property exposed. The font property is of type IFontDisp in the server(delphi). The font properties like Size, Bold, Underline etc...
0
by: Khawar | last post by:
Hi! I was experimenting with .Net property grid control. I found out in an article how to show the properties of Com Based objects using iCustomTypeDescriptor Interface. I tried it on MSHTML...
14
by: shawnk | last post by:
I searched the net to see if other developers have been looking for a writable iterator in C#. I found much discussion and thus this post. Currently (C# 2) you can not pass ref and out arguments...
27
by: sklett | last post by:
I just found myself doing something I haven't before: <code> public uint Duration { get { uint duration = 0; foreach(Thing t in m_things) { duration += t.Duration;
7
by: Paul Connolly | last post by:
char *s = "Hello"; s = 'J'; puts(s); might print "Jello" in a pre-ANSI compiler - is the behaviour of this program undefined in any pre-ANSI compiler - or would it always have printed "Jello"...
2
by: Andreas M. | last post by:
I have an object, that contains a status-property. The status gets set by a function internal to that object. This function gets invoked as /init();/ and sets the status-property of the outer...
4
by: vijaysambhe | last post by:
Hi , Can i populate the class variables in following fashion? public class abc { string name; public string Name {
7
by: shapper | last post by:
Hello, I have the following properties in a class: public List<ObjAA { get; set; } public string B { get; set; } B is always an array created from A.Name property in all A property. How...
0
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
jinu1996
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.