Connecting Tech Pros Worldwide Forums | Help | Site Map

Extra White Space on the HTML form

Newbie
 
Join Date: Oct 2008
Posts: 27
#1: Nov 13 '08
I need some help with extra spaces in HTML form. There is a big white space appearing at the center of the HTML form that I am designing even though there is no <br> tags been used:



The html code is below:

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <meta
  5.     http-equiv="Content-Type"
  6.     content="text/html; charset=ISO-8859-1"
  7. >
  8. <link
  9.     rel="StyleSheet"
  10.     href="CSS/Lite.css"
  11.     type="text/css"
  12. >
  13. <title>Dyadem Support Portal Registration</title>
  14. <SCRIPT LANGUAGE="JavaScript">
  15. function submitForm(){
  16.  
  17.         //Test the entered values
  18.     if (document.registerForm.fname.value==""){
  19.  
  20.     alert("Please enter your First Name.")
  21.     document.registerForm.fname.focus()
  22.     return false
  23.     }
  24.  
  25.     if (document.registerForm.lname.value==""){
  26.     alert("Please enter your Last name.")
  27.     document.registerForm.lname.focus()
  28.     return false
  29.     }
  30.  
  31.     if (document.registerForm.cname.value==""){    
  32.     alert("Please enter the Company name.")
  33.     document.registerForm.cname.focus()
  34.     return false
  35.     }
  36.  
  37.     if (document.registerForm.phone.value==""){    
  38.     alert("Please enter your Phone #.")
  39.     document.registerForm.phone.focus()
  40.     return false
  41.     }
  42.  
  43.     if (document.registerForm.email.value==""){    
  44.     alert("Please enter the email address.")
  45.     document.registerForm.email.focus()
  46.     return false
  47.     }
  48.  
  49.  
  50.     if (document.registerForm.product.value=="ST"){
  51.     document.registerForm.serial.value="Stature"
  52.     }
  53.  
  54.     if (document.registerForm.serial.value==""){
  55.     alert("Please enter the Serial # of the product purchased. If you don't know one, enter N/A.")
  56.     document.registerForm.serial.focus()
  57.     return false
  58.     }
  59.  
  60.     if (document.registerForm.product.value=="Blank"){
  61.     alert("Product purchased can't be blank.")
  62.     document.registerForm.product.focus()
  63.     return false
  64.     }
  65.     return true
  66.  
  67.     }
  68. function isValidEmail() {
  69.     var email = document.registerForm.email.value
  70.     var AtPos = email.indexOf("@")
  71.     var StopPos = email.lastIndexOf(".")
  72.     Message = ""
  73.  
  74.  
  75.     if (AtPos == -1 || StopPos == -1) {
  76.     alert("Not a valid email address")
  77.     return false
  78.     }
  79.  
  80.     if (StopPos < AtPos) {
  81.     alert("Not a valid email address")
  82.     return false
  83.     }
  84.  
  85.     if (StopPos - AtPos == 1) {
  86.     alert("Not a valid email address")
  87.     return false
  88.     } 
  89.  
  90.     return true
  91. }
  92. //function that performs all functions, defined in the onsubmit event handler
  93. function check(form){
  94. if (submitForm()){
  95.         if (isValidEmail()){
  96.         return true
  97.         }
  98.     }
  99.     return false;
  100. }
  101.  
  102. function toFormat(isField){
  103.  
  104. isPhone = isField.value
  105. if (isPhone.length == 12)
  106.     {isPhone = isPhone.replace(/\D/g,'').replace(/^(\d{3})(\d{3})/,'($1) $2-');isField.value = isPhone;}
  107. else if (isPhone.length > 12 && isPhone.length <= 16)
  108.     {isPhone = isPhone.replace(/\D/g,' ').replace(/^(\d{3})( )(\d{3})/,'($1) $3-').replace(/- /,'-').replace(/( )(\d{1,3}$)/,' x $2');isField.value = isPhone;}
  109. else if (isPhone.length < 10 || isPhone.length > 16 || isNaN(isPhone))
  110.     {
  111.     alert('Invalid phone number')
  112.     isField.value = ""
  113.     isField.style.background = 'Yellow';
  114.     isField.focus()
  115.     }
  116. }
  117. </script>
  118. </head>
  119. <body
  120.     bgcolor="WHITE"
  121.     text="#FFFFCC"
  122.     leftmargin="0"
  123.     topmargin="0"
  124.     marginwidth="0"
  125.     marginheigth="0"
  126. >
  127. <div
  128.     class="top_stripe"
  129.     style="FONT-SIZE: xx-large; BACKGROUND-COLOR: #c0c0c0;"
  130. >&nbsp;</div>
  131. <br>
  132. <br>
  133. <br>
  134. <br>
  135. <center><img
  136.     align="center"
  137.     src="Images/Dyadem.gif"
  138. /> <br />
  139. <br />
  140. <br />
  141. <center><b
  142.     style="FONT-FAMILY: 'Arial'; COLOR: #0080c0; FONT-SIZE: large;"
  143. >DYADEM SUPPORT PORTAL</b></center>
  144. <br>
  145. <br>
  146.  
  147. <img
  148.     src="Images/SupportSitePic.bmp"
  149.     align="center"
  150.     style="width: 247px; height: 192px;margin:0; padding:0"
  151. /> <br>
  152. <br>
  153. <center><u><b>New User
  154. Registration</b></u></center>
  155.  
  156. <form // This is the spot where extra space is showing up
  157.     name="registerForm"
  158.     onSubmit="return check(this.form)"
  159.     Method="POST"
  160.     Action="registrationComplete.jsp"
  161.     align="center"
  162. >
  163. <table
  164.     bgcolor="#EAEAEA"
  165.     width="80%"
  166.     style="margin:0; padding:0"
  167. >
  168.     <center>
  169.     <tr>
  170.         <td><Strong>*First Name:</Strong> <input
  171.             type="text"
  172.             name="fname"
  173.         ></td>
  174.     </tr>
  175.     </center>
  176.  
  177.     </br>
  178.     </br>
  179.  
  180.     <center>
  181.     <tr>
  182.         <td><Strong>*Last Name:</Strong>&nbsp; <input
  183.             type="text"
  184.             name="lname"
  185.         ></td>
  186.     </tr>
  187.     </center>
  188.     </br>
  189.     </br>
  190.     <center>
  191.     <tr>
  192.         <td><Strong>*Company:</Strong>&nbsp;&nbsp;&nbsp; <input
  193.             type="text"
  194.             name="cname"
  195.         ></td>
  196.     </tr>
  197.     </center>
  198.     </br>
  199.     </br>
  200.     <center>
  201.     <tr>
  202.         <td><Strong>*Phone #:</Strong> &nbsp;&nbsp;&nbsp; <input
  203.             type="text"
  204.             name="phone"
  205.             onblur="toFormat(this)"
  206.         ></td>
  207.     </tr>
  208.     </center>
  209.     </br>
  210.     </br>
  211.     <center>
  212.     <tr>
  213.         <td><Strong>*Email:</Strong>
  214.         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input
  215.             type="text"
  216.             name="email"
  217.         ></td>
  218.     </tr>
  219.     </center>
  220.     </br>
  221.     </br>
  222.     <center>
  223.     <tr>
  224.         <td><Strong>*Product:</Strong> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select
  225.             style="width: 145px; length: 145px;"
  226.             name="product"
  227.         >
  228.             <option value="Blank"></option>
  229.  
  230.     </tr>
  231.     </center>
  232.     </br>
  233.     </br>
  234.     <center>
  235.     <tr>
  236.         <td>&nbsp;<Strong>Serial #:</Strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  237.         <input
  238.             type="text"
  239.             name="serial"
  240.         ></td>
  241.     </tr>
  242.     </center>
  243.     </br>
  244.     </br>
  245.     <tr>
  246.         <td><MARQUEE
  247.             direction="up"
  248.             scrolldelay="800"
  249.             height="20px"
  250.             onmouseover="this.stop()"
  251.             onmouseout="this.start()"
  252.             width="100%"
  253.         >
  254.         <center><b style="FONT-FAMILY: 'Arial';"> <pre><I
  255.             style="FONT-SIZE: medium; COLOR: #ff0000; FONT-FAMILY: 'Arial';"
  256.         >Please fill out all of the required fields in order to register on Dyadem Support Portal.</pre></I></b>
  257.         <br />
  258.         <b
  259.             style="FONT-FAMILY: 'Arial';"
  260.             <pre><I style="FONT-SIZE: medium; COLOR: #ff0000; FONT-FAMILY: 'Arial';">An Active Support and Maintenance agreement is required to complete the registration.</pre>
  261.         </I></b></center>
  262.         </MARQUEE></td>
  263.     </tr>
  264.     </br>
  265.     </br>
  266.     <tr>
  267.         <td>
  268.         <center><input
  269.             type="reset"
  270.             value="Clear"
  271.         /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input
  272.             type="submit"
  273.             value="Submit"
  274.             name="submit"
  275.         /> &nbsp;&nbsp;&nbsp;&nbsp; <input
  276.             type="button"
  277.             value="Cancel"
  278.             onClick="parent.location='https://support.dyadem.com'"
  279.         /></center>
  280.         </td>
  281.     </tr>
  282. </table>
  283. </form>
  284. </center>
  285. </br>
  286. </br>
  287. <div
  288.     class="top_stripe"
  289.     style="FONT-SIZE: xx-large; BACKGROUND-COLOR: #c0c0c0;"
  290. >&nbsp;</div>
  291. </body>
  292. </html>

eWish's Avatar
Moderator
 
Join Date: Jul 2007
Location: Arkansas
Posts: 900
#2: Nov 13 '08

re: Extra White Space on the HTML form


Try validating your markup and fixing the errors first.


Also, please use the code tag when you are posting markup or code. Thanks.

--Kevin
Expert
 
Join Date: Aug 2008
Posts: 397
#3: Nov 13 '08

re: Extra White Space on the HTML form


With 9 yards of garbage code containing 57 markup validation errors and proprietary HTML consider yourself fortunate it shows up on the screen at all...
Reply


Similar HTML / CSS bytes