473,395 Members | 1,456 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,395 software developers and data experts.

my javascript code works in firefox not in internet explorer.pl reply quickly...

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 
  2. Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
  3. transitional.dtd">
  4. <html>
  5. <head>
  6. <title>Login</title>
  7. <style type="text/css">
  8. h1
  9. {
  10. color:red;
  11. text-align:center;
  12. }
  13. h2
  14. {
  15. color:blue;
  16. text-align:center;
  17. }
  18. div
  19. {
  20. width:250px;
  21.  
  22. padding:20px;
  23. border:5px solid orange;
  24. margin:25px 250px 200px 365px;
  25.  
  26. }
  27. p
  28. {
  29.  
  30. text-align:center;
  31. font-family:Times New Roman;
  32. font-size:20px;
  33. }
  34.  
  35. body
  36. {
  37. background-color:grey;
  38. background-image:url('images.jpg');
  39.  
  40. }
  41. </style>
  42. <script  type="text/javascript">
  43. var REEMAIL = /^(\w+[\-\_\.])*\w+\@(\w+\.)+[A-Za-z]+$/;
  44. function validate(form){
  45.  var userName = form.username.value;
  46.  var password = form.password.value;
  47.  
  48.  var errors = [];
  49.  if (!REEMAIL.test(userName)) {
  50.    errors[errors.length] ="You must enter a valid username.";
  51.  }
  52.  if (!checkLength(userName)) {
  53.   errors[errors.length] = "You must enter a username.";
  54.  }
  55.  if (!checkLength(userName)) {
  56.   errors[errors.length] = "It is not proper email address.";
  57.  }
  58.  if (!checkLength(password)) {
  59.   errors[errors.length] = "You must enter a password.";
  60.  }
  61.  if(!checkpass(password)) {
  62.   errors[errors.length] = " Password must have more than six characters.";
  63.  } 
  64.  
  65. if ( !checkRadioArray(form.container) ) {
  66.   errors[errors.length] = "You must choose any one";
  67.  }
  68.  
  69. if ( !checkCheckBox(form.jtech) && !checkCheckBox(form.indo)) {
  70.   errors[errors.length] = "You must click anyone .";
  71.  }
  72.  
  73.  if (errors.length > 0) {
  74.   reportErrors(errors);
  75.   return false;
  76.  }
  77.  
  78.  return true;
  79. }
  80. function checkLength(text, min, max){
  81.  min = min || 1;
  82.  max = max || 10000;
  83.  
  84.  if (text.length < min || text.length > max) {
  85.   return false;
  86.  }
  87.  return true;
  88. }
  89.  
  90. function checkpass(text,max){
  91.  max= max || 6;
  92.  if(text.length < max) {
  93.  return false;
  94.  }
  95. return true;
  96. }
  97. function checkRadioArray(radioButtons){
  98.  for (var i=0; i < radioButtons.length; i++) {
  99.   if (radioButtons[i].checked) {
  100.    return true;
  101.   }
  102.  }
  103.  return false;
  104. }
  105. function checkCheckBox(cb){
  106.  return cb.checked;
  107. }
  108.  
  109. function reportErrors(errors){
  110.  var msg = "There were some problems...\n";
  111.  var numError;
  112.  for (var i = 0; i<errors.length; i++) {
  113.   numError = i + 1;
  114.   msg += "\n" + numError + ". " + errors[i];
  115.  }
  116.  alert(msg);
  117. }
  118.  
  119. </script>
  120. </head>
  121. <body>
  122. <h1>Registration Form</h1>
  123. <form method="post" action="Process.html"
  124.     onsubmit="return validate(this);">
  125. <div>
  126.  
  127.  <p>
  128. <h2>Login</h2>
  129. Username: <input type="text" name="username" size="20"><br/><br/>
  130. Password: <input type="password" name="password" size="20"><br/><br/>
  131.  
  132. <h2>Gender</h2>
  133.  
  134.  <b>Select the gender</b>
  135.  <input type="radio" name="container" value="Male"> Male
  136.  <input type="radio" name="container" value="Female"> Female
  137.  
  138.  <br/><br/>
  139. <h2>Employee</h2>
  140. <input type="checkbox" name="jtech">
  141.  Jtech
  142.  <input type='checkbox' name="indo">
  143.  Indoshell
  144.  <br/><br/>
  145.  
  146.  <input type="submit" value="Submit">
  147.  <input type="reset" value="Reset Form"> 
  148.  </p>
  149. </div>
  150. </form>
  151. </body>
  152. </html>
The validation was not work in internet explorer....
Feb 11 '10 #1
3 2642
"The validation was not work in internet explorer.... "
Did validate() return true?
Feb 11 '10 #2
please check my script in ur internet explorer n reply me...
Feb 11 '10 #3
Well, I did that and it worked just as it did in firefox. So, I ask again - did validate() return true on your machine? (I'm running IE8)
Feb 11 '10 #4

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

Similar topics

4
by: Ringo Langly | last post by:
Hi everyone, We're using an outside vendor to provide some content for our website, and they use the http_referer variable to verify their content is only viewed from subscribing customers. ...
11
by: minnesotti | last post by:
Hi there, I subscribed to a photographic pictures-hosting website which is heavy on JavaScript. My preferred latest browser Mozilla Firefox does not work with it -- no pictures are displayed and...
8
by: Matt Kruse | last post by:
http://news.zdnet.com/2100-1009_22-6121608.html Hackers claim zero-day flaw in Firefox 09 / 30 / 06 | By Joris Evers SAN DIEGO--The open-source Firefox Web browser is critically flawed in...
3
by: google | last post by:
I am trying to complete a javascript application and am having problems with code similar to that show below. Much testing has shown that Firefox finishes the code shown in around 0.25 secs but...
7
by: John | last post by:
Hi Everyone, I'm having this extremely annoying problem with Internet Explorer 6, giving me an error message saying "unknown runtime error" whenever I try to alter the contents of a <divelement...
16
by: Eric | last post by:
I have a user of a web application written in Java/JSP that is unable to login to the site simply because certain links on the page do not run when they are clicked. Other popups using Javascript...
12
by: tim | last post by:
I am using foldoutmenu 3 and am having problems with viewing my menus in firefox. On my sub3 menus i have more than one line of text in some places. firefox does not recognise that there is more...
7
by: psybert | last post by:
Hello everyone, Long time lurker, first time poster. I'm a beginner coder, and I've taught myself everything with the help and expertise of users and websites like this one. I normally figure out...
21
by: TonyV | last post by:
Hi all, I'm trying to use some javascript code in Internet Explorer 6.0 that's being generated by a Perl file. I have a line in my header that looks something like this: <script...
26
by: Prisoner at War | last post by:
Hi, All: I have a JavaScript search engine that always causes MSIE 7 to do a top-of-page security "warning" (that top-of-page-bar, and not an "alert" )...but other websites' JavaScripts do not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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...

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.