473,513 Members | 2,391 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Any one please help me by seeing this code

29 New Member
This is the code i hav written
in this i hav to call the respective functions
whenever i press a tab using onblur function
please help me......................




[HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/javascript">
<!--
function changePage(newLoc)
{
nextPage = newLoc.options[newLoc.selectedIndex].value
if (nextPage == "month")
{
window.alert("Enter MONTH");
document.demo.selectedPage.focus();
}
}
function change1Page(newLoc1)
{
nextPage1=newLoc1.options[newLoc1.selectedIndex].value
if(nextPage1=="date")
{
window.alert("Enter DATE");
document.demo.selected1Page.focus();
}
}
function change2Page(newLoc2)
{
nextPage2=newLoc2.options[newLoc2.selectedIndex].value
if(nextPage2=="year")
{
window.alert("Enter YEAR");
document.demo.selected2Page.focus();
}
}
-->
</script>
</head>
<body>
<form name="demo">
Date Of Birth: <select name="selectedPage"
onblur="changePage(document.demo.selectedPage)">
<option value="month" selected="selected">select month</option>
<option>Jan</option>
<option>Feb</option>
<option>Mar</option>
<option>Apr</option>
<option>May</option>
<option>Jun</option>
<option>Jul</option>
<option>Aug</option>
<option>Sep</option>
<option>Oct</option>
<option>Nov</option>
<option>Dec</option>
</select>
<select name="selected1Page" onblur="change1Page(document.demo.selected1Page)">
<option value="date" selected="selected">select date</option>
<option>1</option><option>2</option><option>3</option><option>4</option><option>5</option><option>6</option><option>7</option>
<option>8</option><option>9</option><option>10</option><option>11</option><option>12</option><option>13</option><option>14</option><option>15</option><option>16</option><option>17</option><option>18</option><option>19</option><option>20</option>
<option>21</option><option>22</option><option>23</option><option>24</option><option>25</option><option>26</option>
<option>27</option><option>28</option><option>29</option><option>30</option><option>31</option>
</select>
<select name="selected2Page" onblur="change2Page(document.demo.selected2Page)">
<option value="year" selected="selected">select year</option>
<option>1955</option><option>1956</option><option>1957</option><option>1958</option><option>1959</option><option>1960</option>
<option>1961</option><option>1962</option><option>1963</option><option>1964</option><option>1965</option><option>1966</option>
<option>1967</option><option>1968</option><option>1969</option><option>1970</option><option>1971</option><option>1972</option>
<option>1973</option><option>1974</option><option>1975</option><option>1976</option><option>1977</option><option>1978</option><option>1979</option><option>1980</option><option>1981</option><option>1982</option><option>1983</option><option>1984</option>
<option>1985</option><option>1986</option><option>1987</option><option>1988</option><option>1989</option><option>1990</option>
</select>
</form>
</body>
</html>[/HTML]
Feb 21 '07 #1
6 1073
acoder
16,027 Recognized Expert Moderator MVP
Instead of onblur why not use onchange?
Feb 21 '07 #2
prakashsurya
29 New Member
Ok thank you
i know the functionality of onchange
just i want to know whether we can go with onblur r not as i hav specified in the code.
Feb 23 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
Well, should not use onblur which can cause problems (because it might be caused by something other than a tab key press). What you can do instead is detect the tab key by setting the onkeyup event handler. The key code is 9 for tab.

I, however, would suggest that you use onchange instead because it only detects when the user makes a change. You can always make a final check when the user tries to submit the form.

btw, this is when you are using alert boxes. If you are just displaying a string error message next to the element, it might be ok. Note that changing the default behaviour (moving focus to the next element) can cause problems.
Feb 23 '07 #4
prakashsurya
29 New Member
k thank u for ur suggestion
Feb 23 '07 #5
dmjpro
2,476 Top Contributor
i also have that problem ...

a best suggestion i was waiting for === acoder

looootttttt of thanxxxxxxx
Feb 24 '07 #6
acoder
16,027 Recognized Expert Moderator MVP
Both of you are welcome. Glad it helped you.
Feb 26 '07 #7

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

Similar topics

3
2556
by: James | last post by:
Please help - getting very desperate! Sun, 12 October 2003 05:39 I have PHPDEV 4.2.3 from Firepages.com.au as the upgrade to 4.3.0 did not work. I also had an abortive download from PHP.NET as...
5
3472
by: duikboot | last post by:
Hi all, I'm trying to export a view tables from a Oracle database to a Mysql database. I create insert statements (they look alright), but it all goes wrong when I try to execute them in Mysql,...
5
1739
by: Joe | last post by:
Please repost answer message did not make it last time Hello, Joe here, wanted to get the 411 on this article. I posted in the FrontPage forum but there is never an answer. So I have come...
1
2215
by: MR | last post by:
Hi, it has been observed that when we try to instantiate a .Net dll for the first time in a session (e.g. from an exe in .Net), it takes almost 10 times compared to subsequent instantiations. ...
7
2111
by: RobG | last post by:
Can someone explain to me why Firefox barfs on background and border in the following CSS and doesn't display the site the same as IE: #nav, #nav ul { background: <iw_value...
8
2011
by: Richard Maher | last post by:
Hi, I am in a mouseup event for button A and I'd like to disable=false button B before starting some work. Is there anyway that an event for button B can then fire before my event processing for...
5
5350
by: =?Utf-8?B?a3Jpcw==?= | last post by:
Hi all, How to handle exceptions of webservices? I have a wsdl file which contains the exception classes. when i am adding that wsdl file in my asp application I am unable to view those...
62
2660
by: vubaboota | last post by:
I HAVE SOME SERIOUS PROBLEM , HOW TO MAKE A PROGRAM IN C Q1: Write a program using malloc function. In which you take input from user and allocate memory equal to square of this number. Which...
61
3493
by: warint | last post by:
My lecturer gave us an assignment. He has a very "mature" way of teaching in that he doesn't care whether people show up, whether they do the assignments, or whether they copy other people's work....
0
7171
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
7388
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
7545
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...
1
7111
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
7539
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
4751
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3228
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
461
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.