473,396 Members | 1,678 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.

cannot delete inputs

smiley22
hi guys, i had a problem with my codes, the problem is I cannot delete the inputs in the first 3 fields if I want to delete it.

Here is the code:

[HTML]<head>
<script language="JavaScript">

function switch_next(cur_obj,next){
if(cur_obj.value.length==3)
document.getElementById(next).focus();
}
</script>
</head>

<body>
<form id="myForm">
<input type="text" name="txtTin1" id="txtTin1" value="" size="3" maxlength="3"

onkeydown = "switch_next(this,'txtTin2')" tabindex="1">
<input type="text" name="txtTin2" id="txtTin2" value="" size="3" maxlength="3"

onkeydown = switch_next(this,'txtTin3') tabindex="2">
<input type="text" name="txtTin3" id="txtTin3" value="" size="3" maxlength="3"

onkeydown = switch_next(this,'txtTin4') tabindex="3">
<input type="text" name="txtTin4" id ="txtTin4" value="" size="3" maxlength="3"

tabindex="4">
</form>
</body>

</html>[/HTML]


BEst of luck to all

Regards also.


Thanks :-)
Aug 29 '07 #1
4 1257
JosAH
11,448 Expert 8TB
Greetings, you just asked a Javascript question in the Java forum. The two have
nothing much in common, despite their names. I'll move your question over to
the Javascript forum (see the blue menu bar near the top of this page and click
'the Forums' item).

kind regards,

Jos
Aug 29 '07 #2
r035198x
13,262 8TB
hi guys, i had a problem with my codes, the problem is I cannot delete the inputs in the first 3 fields if I want to delete it.

Here is the code:

[HTML]<head>
<script language="JavaScript">

function switch_next(cur_obj,next){
if(cur_obj.value.length==3)
document.getElementById(next).focus();
}
</script>
</head>

<body>
<form id="myForm">
<input type="text" name="txtTin1" id="txtTin1" value="" size="3" maxlength="3"

onkeydown = "switch_next(this,'txtTin2')" tabindex="1">
<input type="text" name="txtTin2" id="txtTin2" value="" size="3" maxlength="3"

onkeydown = switch_next(this,'txtTin3') tabindex="2">
<input type="text" name="txtTin3" id="txtTin3" value="" size="3" maxlength="3"

onkeydown = switch_next(this,'txtTin4') tabindex="3">
<input type="text" name="txtTin4" id ="txtTin4" value="" size="3" maxlength="3"

tabindex="4">
</form>
</body>

</html>[/HTML]


BEst of luck to all

Regards also.


Thanks :-)
1.) Use code tags everytime when posting code
2.) Java != Javascript

Moved to Javascript forum
Aug 29 '07 #3
dmjpro
2,476 2GB
hi guys, i had a problem with my codes, the problem is I cannot delete the inputs in the first 3 fields if I want to delete it.

Here is the code:
Expand|Select|Wrap|Line Numbers
  1. <head>
  2. <script language="JavaScript">
  3.  
  4. function switch_next(cur_obj,next){
  5.     if(cur_obj.value.length==3) 
  6.         document.getElementById(next).focus();
  7. }
  8. </script>
  9. </head>
  10.  
  11. <body>
  12. <form id="myForm">
  13.     <input type="text" name="txtTin1" id="txtTin1" value="" size="3" maxlength="3"  
  14.  
  15. onkeydown = "switch_next(this,'txtTin2')" tabindex="1">
  16.     <input type="text" name="txtTin2" id="txtTin2" value="" size="3" maxlength="3" 
  17.  
  18. onkeydown = switch_next(this,'txtTin3') tabindex="2">
  19.     <input type="text" name="txtTin3"  id="txtTin3" value="" size="3" maxlength="3" 
  20.  
  21. onkeydown = switch_next(this,'txtTin4') tabindex="3">
  22.     <input type="text" name="txtTin4" id ="txtTin4" value="" size="3" maxlength="3" 
  23.  
  24. tabindex="4">
  25. </form>
  26. </body>
  27.  
  28. </html>
  29.  
BEst of luck to all

Regards also.


Thanks :-)
You better to use Code Tags as mentioned at the Right Side of the Page.
You should follow that.
Update the switch_next function.
Expand|Select|Wrap|Line Numbers
  1. function switch_next(e,cur_obj,next){
  2.         var k = e.which ? e.which : e.keyCode;
  3.         if(k==8/*Back space*/ || k==46/*Del*/) return;
  4.     if(cur_obj.value.length==3) document.getElementById(next).focus();
  5. }
  6.  
And in HTML also...!

Expand|Select|Wrap|Line Numbers
  1. <input type = text onlcick = switch_next(event,this,next_textbox)>
  2.  
I think it will work fine.
Best of Luck with your try.

Kind regards,
Dmjpro.
Aug 29 '07 #4
You better to use Code Tags as mentioned at the Right Side of the Page.
You should follow that.
Update the switch_next function.
Expand|Select|Wrap|Line Numbers
  1. function switch_next(e,cur_obj,next){
  2.         var k = e.which ? e.which : e.keyCode;
  3.         if(k==8/*Back space*/ || k==46/*Del*/) return;
  4.     if(cur_obj.value.length==3) document.getElementById(next).focus();
  5. }
  6.  
And in HTML also...!

Expand|Select|Wrap|Line Numbers
  1. <input type = text onlcick = switch_next(event,this,next_textbox)>
  2.  
I think it will work fine.
Best of Luck with your try.

Kind regards,
Dmjpro.


ah ok, next time, i'll use tags, sorry for that.

by the way, the code already worked,

Thanks for your help. You are guys are so cool!!!

Best of luck to all! :-)

Take care always..
Aug 29 '07 #5

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

Similar topics

20
by: Brad Eck | last post by:
"The only operators that cannot be overloaded are :: (scope resolution), . (member selection), and .* (member selection through pointer to function). Quoting from Stroustrup's 3rd edition of _The...
3
by: Stewart Graefner | last post by:
What do I need to use to be able to make information in a table be deleteable by a User? The table I have tracks Vacation time. It has two fields Vacation Dates and Days taken(Default value 0). The...
15
by: MLH | last post by:
Mr Leigh Purvis gave me a very clever piece of SQL to accomplish what is probably an uncommon objective. In it, he uses the EXISTS operator. I can find no documentation on it in A97 HELP. I would...
0
by: hharry | last post by:
hello all, i have created a simple web service: public class ImmediateResponse : System.Web.Services.WebService { public ImmediateResponse() { }
2
subashini Thiyagarajan
by: subashini Thiyagarajan | last post by:
hi, i want to delete a record.hope it is very easy.but same time i want to move the deleted record in to new table for report generation in future. i succeeded in deleting the record along with...
5
by: streamkid | last post by:
i have a class table, which has a vector of records(-db). i 'm trying to remove an element, but it doesn't seem to work.. i read this http://www.cppreference.com/cppvector/erase.html] and that's...
12
by: Premal | last post by:
Hi, I tried to make delete operator private for my class. Strangely it is giving me error if I compile that code in VC++.NET. But it compiles successfully on VC++6.o. Can anybody give me inputs...
2
by: SCPOS | last post by:
Cannot delete X: It is being used by another person or program. Close any programs that might be using the file and try again. Of course I have tried closing any programs I know of that may be...
8
by: Stefano Sabatini | last post by:
Hi all, I'm encountering this while trying to implement a factory singleton method to generate objects. The singleton has a static map which binds a static creation function defined in each...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...

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.