Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Changing form dimensions in Javascript

Options
  • 08-02-2007 11:35am
    #1
    Registered Users Posts: 1,583 ✭✭✭


    How do i set form (not table) height in java script?
    Example:
    I want to make the below code 21px in height
    But when i put it in a table 21px in height it expands the table to 33px. Where do I change the 33px to 21px?
    If you're confused go to www.icefusionf1.com and look at the mailing list at the top. There is wasted space.
    //  **********************************************************
    //  *                /email_list_lite/                       *
    //  *           Author:   www.Seiretto.com                   *
    //  *    © Copyright /email_list_lite/ Seiretto.com          *
    //  *              All rights reserved.                      *
    //  **********************************************************
    //  *        Launch Date:  May 2003                          *
    //  *                                                        *
    //  *     Version    Date              Comment               *
    //  *     1.0f       29th May 2003      Original release     *
    //  *                                                        *
    //  *  NOTES:                                                *
    //  *        Requires:  PHP 4.2.3 (or greater)               *
    //  *                   and MySQL                            *
    //  **********************************************************/
    var email_list_lite_version="1.0f";
    // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    var message1="";
    var message2="";
    
    var theserver="http://www.icefusionf1.com/email_list_lite/validate.php";
    theform="<form method=\"POST\" name=\"FF\" action=\"" +theserver+ "\" target=\"e2afWin\">";
    theform=theform + "Join the Ice Fusion F1 Newsletter: <input type=\"text\" name=\"email_addr\" value=\"Enter E-mail\" size=\"30\" onfocus=\"email_addr_onfocus()\"><select name=\"action\" size=\"1\" ONChange=\"set_action()\">";
    theform=theform + "<option selected value=\"1\">Join List</option><option value=\"0\">Leave List</option>";
    theform=theform + "</select> <input type=\"button\" onclick=\"validateForm()\" value=\"Join List\" name=\"Button\"></form>";
    
    document.write(theform);
    
    function set_action()
    {
     with (document.FF)
     {
      if (action.value=="1") Button.value="Join List";
      else Button.value="Leave List";
     }
    }
    
    function validateForm()
    {
     var okSoFar=true
     var foundAt = 0
     var foundDOT = 0
     var foundSpace = 0
     var foundDQuote = 0
     var foundSQuote = 0
     with (document.FF)
     {
      if (email_addr.value=="" && okSoFar)
      {
        okSoFar = false
        alert ("Please enter an email address.")
        email_addr.focus()
      }
     if (email_addr.value>"" && okSoFar)
      {
       foundAt = email_addr.value.indexOf("@",0)
       foundDOT = email_addr.value.indexOf(".",0)
       foundSpace = email_addr.value.indexOf(" ",0)
       foundDQuote = email_addr.value.indexOf("\"",0)
       foundSQuote = email_addr.value.indexOf("\'",0)
      }
      if (foundAt < 1 && okSoFar)
      {
        okSoFar = false
        alert ("Please enter a valid email address.")
        email_addr.focus()
      }
      if (foundDOT < 1 && okSoFar)
      {
        okSoFar = false
        alert ("Please enter a valid email address.")
        email_addr.focus()
      }
      if (foundSpace > 1 && okSoFar)
      {
        okSoFar = false
        alert ("There is a space within the email address this is not valid, please re-enter.")
        email_addr.focus()
      }
      if (foundDQuote > 1 && okSoFar)
      {
        okSoFar = false
        alert ("There is a double quote within the email address this is not valid, please re-enter.")
        email_addr.focus()
      }
      if (foundSQuote > 1 && okSoFar)
      {
        okSoFar = false
        alert ("There is a single quote within the email address this is not valid, please re-enter.")
        email_addr.focus()
      }
      if (okSoFar==true)
      {
       e2afWin='toolbar=0,directories=0,fullscreen=0,menubar=0,scrollbars=0,resizable=0,width=300,height=170,top=50,left=50';
       var e2afWindow = null;
       if(e2afWindow != null) if(!e2afWindow.closed) e2afWindow.close()
       loading="http://www.icefusionf1.com/email_list_lite/loading.html";
       e2afWindow=open(loading,'e2afWin', e2afWin);
       e2afWindow.focus();
       submit();
      }
    }
    }
    
    TimerID1=setTimeout('moveit(message1)',100);
    countit=0;
    run_message1=1;
    function moveit(tmsg)
    {
     document.FF.email_addr.value= document.FF.email_addr.value+tmsg.charAt(countit) ;
     countit++;
     if (countit==tmsg.length)
     {
      countit=0;
      clearTimeout(TimerID1);
      document.FF.email_addr.value="";
      if (run_message1==1) run_message1=0;
      else run_message1=1;
     }
     if (run_message1==1) TimerID1=setTimeout('moveit(message1)',100);
     else TimerID1=setTimeout('moveit(message2)',100);
    }
    
    function email_addr_onfocus()
    {
      clearTimeout(TimerID1);
      document.FF.email_addr.value="";
    }
    


Comments

  • Closed Accounts Posts: 382 ✭✭misterq


    It has nothing to do with the code you posted.

    In the html, the table row in which it is called is 33px in height:
              <tr>
    
                <td style="width: 26px; vertical-align: top; background-color: rgb(204, 204, 204); height: 33px;" background=""><img style="width: 26px; height: 21px;" src="images/graybarleft.gif"></td>
                <td style="text-align: center; height: 33px;" background="images/topgraybg.gif">  
             <script language="JavaScript" src="http://www.icefusionf1.com/email_list_lite/email_list_style_1.js"></script></td>
                <td style="height: 33px;" background="images/graybarright.gif" width="20">&nbsp;</td>
              </tr>
    


    Change those height values to 21 if that is what you want


  • Registered Users Posts: 1,583 ✭✭✭alan4cult


    Thanks, but tried that and the script seems to expand it back to 33px any other ideas?


  • Registered Users Posts: 3,594 ✭✭✭forbairt


    not saying it'll work .. but try some css ...

    form { padding:0; margin:0; clear:none; }

    might have a look later if I've time


  • Registered Users Posts: 1,583 ✭✭✭alan4cult


    bump


  • Registered Users Posts: 3,594 ✭✭✭forbairt


    alan4cult wrote:
    bump

    I'll assume you tried out what I said and it didn't work then ?


  • Advertisement
  • Registered Users Posts: 1,583 ✭✭✭alan4cult


    Yes I have tried that but have found out that the problem doesn't occur in Firefox


Advertisement