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

onfocus()

Hello friends.........

In my project i use 2 textfields(name and designation). both the text fields should enter only letters and no numbers should be enterd. i wrote the function for it and i called it in the onBlur function of the textfields. but the problem is that if i enter any number or simply press the tab button it shows the alert message" invalid entry" and it keeps on goin in the loop. i have to press ctrl+alt+del to terminate the pgm.. if i change the on blur to onchange it works fine, but the focus function is not working....

Expand|Select|Wrap|Line Numbers
  1. function isAlphabetic(val)
  2. {
  3.  
  4. if (val.value.match(/^[ a-zA-Z.]+$/))
  5.     {
  6.         return true;
  7.     }
  8.     else
  9.     {
  10.         alert("hi Invalid Entry");
  11.         val.focus();
  12.         return false;
  13.     }
  14.  
  15. }
thanks..
Apr 8 '08 #1
1 1939
TheServant
1,168 Expert 1GB
Where is your code which has the onblur/onchange? Also use the correct code tags for your post.
Apr 8 '08 #2

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

Similar topics

2
by: Mike Berger | last post by:
So, I'm fairly new to this and my code is as follows... <script language="JavaScript> var oldValue function focusElement(theElement) { oldValue = theElement.value; return; } </script>
1
by: Rich Morey | last post by:
Hello, I have created a form and assigned each of the form elements to a class in a style sheet. I would like to know if it is possible to add 'OnFocus' and 'OnBlur' events to the style sheet...
1
by: Michael Albanese | last post by:
I am developing an application to handle my compay's OSHA reporting requirements. Some of the input criteria are technical and narowly defined, so I was trying to prvide what i call "Context...
2
by: Paresh Shah | last post by:
Hi Friends... I have an query on how to capture onFocus event for all the input controls without writing onFocus event in the <input> tag. say my html form has 3 or 4 or 5 input text boxes,...
2
by: swathi | last post by:
----------------------------------------------------------------------- A poll associated with this post was created, to vote and see th results, please visit...
1
by: Tzachi | last post by:
Hello all, I have a function that dynamically adds rows and columns to the page. Everything works well except onfocus // onblur attributes. For some reason, when entering the input box it...
1
by: Eric Trav | last post by:
Hello, I am using mozilla and javascript to change the style background color for my select with onfocus() and back to white with onblur(). When i process onfocus(); i have to click on the...
1
by: clemtig | last post by:
Say I have a form with two input textfields. Each has an onFocus and onBlur. onFocus will unhide image #1. onBlur will hide image #1, show image #2 and validate the textfield. But the problem is that...
4
by: spree | last post by:
Hi, I have a coloumn of buttons where i would like to highlight it when focussed... So, i have used onFocus element for it. Till here its ok. But if i set any background color for the button and...
0
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...
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
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
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
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.