I'm not that great at reading javascripts.
Instead of doing nothing I'd like to return a Tab-character, if Enter
occurs:
<script language="javas cript" type="text/javascript" >
//disable enter-key
function kH(e) {
var pK = e ? e.which : window.event.ke yCode;
return pK != 13;
}
document.onkeyp ress = kH;
if (document.layer s) document.captur eEvents(Event.K EYPRESS);
</script>
To help me undertand: What is "e"? What is "!=" ? (i'm used to vb).
Regards /Snedker 5 1456
Hi Morten,
Instead of doing nothing I'd like to return a Tab-character, if Enter
occurs:
<script language="javas cript" type="text/javascript" >
//disable enter-key
function kH(e) {
var pK = e ? e.which : window.event.ke yCode;
return pK != 13;
}
document.onkeyp ress = kH;
if (document.layer s) document.captur eEvents(Event.K EYPRESS);
</script>
you want to retrun a Tab, but to whom? This example script will disable the
enter key simply be looking for the keyCode (which is something like the
ASCII code).
Maybe you should ask what you do instead?!
--
Best regards | Schöne Grüße
Michael
Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer http://weblogs.asp.net/mschwarz/ http://www.ajaxpro.info/
On Tue, 5 Dec 2006 15:07:54 +0100, "Michael Schwarz"
<no****@schwa rz-interactive.dew rote:
I wish to move to the next field in the tab-index. I reckon it is
something like nextfield.focus - but still, I don't know where to put
it.
I guess what I'm really missing is a Javascript Beginners Guide. :-)
But till then? ;-)
>Instead of doing nothing I'd like to return a Tab-character, if Enter occurs:
<script language="javas cript" type="text/javascript" > //disable enter-key function kH(e) { var pK = e ? e.which : window.event.ke yCode; return pK != 13; } document.onkeyp ress = kH; if (document.layer s) document.captur eEvents(Event.K EYPRESS); </script>
you want to retrun a Tab, but to whom? This example script will disable the enter key simply be looking for the keyCode (which is something like the ASCII code).
Maybe you should ask what you do instead?!
Morten,
Good morning!
To explain the ?, look at: http://www.c-point.com/javascript_tu...onditional.htm
Basically the ? is an operator that does a quick if then else for you.
so the line
var pK = e ? e.which : window.event.ke yCode
is saying that if e is true, then set pK = e.which, which means that
the user is using Netscape/Firefox and if e is false, set pK to
window.event.ke yCode , which means that the user is using IE.
This is another way of doing the same:
if(window.event ) // IE
{
pK = e.keyCode
}
else if(e.which) // Netscape/Firefox/Opera
{
pK= e.which
}
!= means not equal to
Hope this is of some help,
Kathryn
Morten Snedker wrote:
On Tue, 5 Dec 2006 15:07:54 +0100, "Michael Schwarz"
<no****@schwa rz-interactive.dew rote:
I wish to move to the next field in the tab-index. I reckon it is
something like nextfield.focus - but still, I don't know where to put
it.
I guess what I'm really missing is a Javascript Beginners Guide. :-)
But till then? ;-)
Instead of doing nothing I'd like to return a Tab-character, if Enter
occurs:
<script language="javas cript" type="text/javascript" >
//disable enter-key
function kH(e) {
var pK = e ? e.which : window.event.ke yCode;
return pK != 13;
}
document.onkeyp ress = kH;
if (document.layer s) document.captur eEvents(Event.K EYPRESS);
</script>
you want to retrun a Tab, but to whom? This example script will disable the
enter key simply be looking for the keyCode (which is something like the
ASCII code).
Maybe you should ask what you do instead?!
Hi,
kbutterly wrote:
Morten,
Good morning!
To explain the ?, look at: http://www.c-point.com/javascript_tu...onditional.htm
Basically the ? is an operator that does a quick if then else for you.
so the line
var pK = e ? e.which : window.event.ke yCode
is saying that if e is true, then set pK = e.which, which means that
Actually, this works because for JavaScript, if an object is null, it
can be tested against false. If it is not null, it can be tested against
true. So the line above actually means "if e is not null, assign e.which
to pK, or else assign window.event.ke yCode. This is to avoid a null
reference exception, should e be null.
Note that the code above is not 100% safe, because window.event doesn't
get tested against null. Additionally, maybe e.which or
window.event.ke yCode are undefined.
HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Hi Morten,
I wish to move to the next field in the tab-index. I reckon it is
something like nextfield.focus - but still, I don't know where to put
it.
the only thing you can do is to call the .focus() method of the next
control:
<input type="text" id="field1"
onkeypress="if( window.event.ke yCode==13)docum ent.getElementB yId('field2').f ocus();">
<input type="text" id="field2">
I guess what I'm really missing is a Javascript Beginners Guide. :-)
;)
--
Best regards | Schöne Grüße
Michael
Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer http://weblogs.asp.net/mschwarz/ http://www.ajaxpro.info/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: J. Nielsen |
last post by:
I'm not a programmer and I don't have the time and energy to start learning
right now So I need some help.
Let's say I have made an HTML Table (consisting of three columns and six
rows). In each cell, in the first column I have put in an image (six
different ones).
In the second column I have merged all six cells into one cell and there put
in an image matching the background colour.
In the right column I have again put in six different...
|
by: Mike |
last post by:
I've been trying for the past week to put a simple code together. I
have done a LOT of searching, found scripts showing the functions I
would like to use, however when I mix them it all goes wrong, somehow
I always end up with error messages and functions not working right.
Can someone please help me?
I have a form, inside is 1 Text Field and 2 Password Fields. What I'm
looking to do is:
- Make sure password fields are equal
- Set...
|
by: TeknoCat |
last post by:
Hey everyone,
I may be repeating myself here, but if someone sent a reply then I missed
it, and I can't get Outlook Express to download any messages more than 2
days old.
Anyway, I'm having a problem with some new pages I am creating for the Web
site at www.weaverdevore.ca and I am wondering if anyone here might be able
to help. Here is a full description of the problem:
|
by: Jack |
last post by:
I have a asp form where among others there are few text boxes and one check
box. The checkbox is
to indicate whether the entry is final. The checkbox is attahced to a field
in table of type yes/no.
After saving the documents,the form is refreshed. At this point, if the
checkbox has been saved with checked,
it shows unchecked, if it has been saved unchecked it shows unchecked.
Here, if the checkbox shows checked, I want to disable (or...
|
by: E |
last post by:
I am having trouble with setTimeout working on a second call to the
setTimeout function from a second page which is an html page.
Here is the scenario.
I have a web page and onload it calls a javascript function which calls
setTimeout and will process a second javascript function "Warn" just before
the session expires. The Warn function displays an html page with a
button. A second timer is started to cause the html page to close...
| |
by: Tom Cole |
last post by:
I bet 50% of the posts I've read lately have had at least one bad thing
to say about every website or book dedicated to javascript.
There are clearly a few posters (you know who you are) who either are
or consider themselves to be the "comp.land.javascript elite". You guys
may be the brightest, most seasoned developers out there, and hats off
to you. You may not be, how the heck would I know. But...
Not to be too critical (which sounds...
|
by: mrtaka79 |
last post by:
Okay, first of all, I'm a complete noob, so go easy on me. I have this
code that works perfectly for me. The only thing I want to add is to
randomize the pictures/links that show up. Can anyone just tell me
where to add additional code to the following? BTW this is the only
code I could find that works in my Beta Blogger sidebar.
<a href="javascript:gotoshow()"><img border="0" width="300"
src="/OneMissedCall1.jpg" name="slide"...
|
by: gunimpi |
last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431
********************************************************
VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help
wanted
********************************************************
For this teeny job, please refer to:
http://feeds.reddit.com/feed/8fu/?o=25
|
by: Tom Cole |
last post by:
I'm working on a small Ajax request library to simplify some tasks
that I will be taking on shortly. For the most part everything works
fine, however I seem to have some issues when running two requests at
the same time. The first one stops execution as the second continues.
If I place either an alert between the two requests or run the second
through a setTimeout of only 1 millisecond, they both work. You can
see a working example here:...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |