473,473 Members | 2,248 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Create new row on tab key press

8 New Member
Hi,

I have one row with two text boxes.
When the cursor moves out of the second text box it will create
another row. But what i want is if i press only tab key,
it should create a new row. I wrote the code for that by
capturing the key code of tab in javascript.
It's not worknig. Moreover whent it creates new row,
the cursor should focus on the first text box.

Thanks in advance,
The html code is as follows.


[HTML]<html>
<head>
<script>
var numOfLines = 2;
function generateRow()
{
if (window.event.keyCode == 9)
{
var d=document.getElementById("div");
d.innerHTML += "<input type='text' name='quantity"+numOfLines+"'>&nbsp&nbsp";
d.innerHTML += "<input type='text' name='itemCode"+numOfLines+"' onBlur='generateRow()'><br>" ;
var felementVal = "quantity"+numOfLines;
alert(felementVal);
var felement = eval("document.forms[0].quantity"+numOfLines);
felement.focus();
felement.focus();
numOfLines += 1;
}

}

</script>
</head>
<body>
<form>

Quantity &nbsp&nbsp ItemCode<br>
<input type=text name="quantity1" >
<input type="text" name="itemcode1" onBlur="generateRow()">

<div id="div"></div>


<!-- <input type="button" value="Add" onclick="generateRow()"/> -->



</form>
<body>
</html>[/HTML]
Feb 22 '07 #1
2 4859
acoder
16,027 Recognized Expert Moderator MVP
Your code is IE-specific. Use onkeyup to check for each key pressed. Then in generateRow, have an 'e' argument. For a cross-browser key pressed check, see this link.
Feb 22 '07 #2
acoder
16,027 Recognized Expert Moderator MVP
Title changed.
Feb 22 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Sam | last post by:
Hi, I integrated the following programs in freebsd 5.4. phpldapadmin openldap 2.2_26 courier-imap courier-authlib courier-authdaemon cyrus-sasl2-saslauthd postfix
1
by: asdasd | last post by:
Hello there, I'm hoping someone might be able to help me out. Its been awhile since I've programmed in visual basic (and roughly at that)... I want to create a program that will allow me to...
5
by: InstallAware | last post by:
For Press Inquiries: Sinan Karaca InstallAware Software Corporation 336 Guerrero Street, San Francisco CA 94103 415 358 4094 (voice/fax) sinank@installaware.com http://www.installaware.com/ ...
8
by: dixie | last post by:
I want to run an event when I press the Ctl key simultaneously with the K key. How do I achieve this in VBA? dixie
10
by: dx | last post by:
I have the Microsoft Press: Developing Microsoft ASP.NET Server Controls and Components book. It's starting to shine some light on control development but there is something about composite...
1
by: harish | last post by:
hello, I am trying to write code for form activate event and for an event of an object. Generally, you select the object/form from the top combo box in visual studio ide, and select the event...
17
by: Philip Wagenaar | last post by:
I have an excel sheet that has several lines. Each line is an order. Example: 1 Paper 10 2 Pencils 20 etc... When the excel sheet is filled out I want the user to press a...
8
by: barb | last post by:
So that the world at large benefits from our efforts, here is one fully documented way to use Windows Irfanview freeware to create thumbnail web galleries (http://www.irfanview.com). STEP 1:...
1
by: yamyliz | last post by:
Well I dont know if this is of any help but here it goes: I put a text box (Text3) and 16 command buttons. For each commandbutton I entered a code, like this: 1 --> Text3 = "1" 2 --> Text3...
2
by: Candice Stewart | last post by:
i am trying to create a loop that exits when i press enter twice with blank lines. I've tried different methods but still can't think of a method that works. When this codes entered the input is...
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
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
tracyyun
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...
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,...
1
isladogs
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...
0
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...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
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...

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.