Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jul 2004
    Location
    Lebanon
    Posts
    223
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Unhappy Javascript inside forms

    Hey there,

    I'm having a javascript problem and I can't really figure this out, some help would be greatly appreciated.

    I have this custom made html/javascript form that passes the submitted values to another form (iframe) found on another website. All the fields are working except the "Country" field.

    You can view the form online here: http://www.avis.com.lb

    I don't really know what's going on there :/

    Here is the javascript on the page;
    Code:
    <script type = "text/javascript">
    var bgMemory;    // save color information
    var fgMemory;
    var     statusinfo = false;
    function mOver(cell, id, statustxt)
    {
        
          cell.style.cursor = 'hand';
          cell.style.backgroundColor='#e6e6e6';
        if (typeof document.getElementById(id + "cc") == "object")
        {
            Elem = document.getElementById(id + "cc");
            bgMemory = Elem.style.backgroundColor;
            Elem.style.backgroundColor='#e6e6e6';
        }
        if (typeof document.getElementById(id + "l") == "object")
        {
            Elem = document.getElementById(id + "l");
            fgMemory = Elem.style.color;
            Elem.style.color='#3D6484';
        }
        window.status=statustxt;
        statusinfo = true;
        return true;
    }
    function mOut(cell, id)
    {
        
          cell.style.cursor = 'hand';
          cell.style.backgroundColor='';
          window.status="";
        if (typeof document.getElementById(id) == "object")
        {
            Elem = document.getElementById(id + "cc");
            Elem.style.backgroundColor = bgMemory;
        }
        if (typeof document.getElementById(id + "l") == "object")
        {
            Elem = document.getElementById(id + "l");
            Elem.style.color = fgMemory;
        }
        window.status='';
        statusinfo = false;
        return true;
    }
    function mClick(cell)
    {
       if(event.srcElement.tagName=='TD')
       {
          cell.children.tags('A')[0].click();
       }
    }
    </script>
    <script type = "text/javascript">
    var xMonths = new Array( 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec' );
    
    function getListValue( option_object  ){return option_object[ option_object.selectedIndex ].value;}
    
    function setListValue( option_object, value  ){ option_object.selectedIndex = value;}
    
    function addDays(myDate,days) {
        return new Date(myDate.getTime() + days*24*60*60*1000);
    }
    function init()
    {
    xToday = new Date();
    yToday = addDays(new Date(),3);
    
    xMonth = xToday.getMonth();
    xDay = xToday.getDate()-1;
    xYear = xToday.getYear()-2005; if (xYear < 2005) xYear=0;
    
    yMonth = yToday.getMonth();
    yDay = yToday.getDate()-1;
    yYear = yToday.getYear()-2005; if (yYear < 2005) yYear=0;
      xF = document.forms['quickbooking'];
      setListValue( xF.ETAHour, 9 )
      setListValue( xF.ETAMonth, xMonth )
      setListValue( xF.ETADay, xDay )
      setListValue( xF.ETAYear, xYear )
      setListValue( xF.ETTHour, 9 )
      setListValue( xF.ETTMonth, yMonth )
      setListValue( xF.ETTDay, yDay )
      setListValue( xF.ETTYear, yYear )
    }
    
    
    function openhelp( hlpString )
    {
        hlpWin = window.open( hlpString , 'Help', 'width=395,height=345,resizable=yes,scrollbars=yes,status=yes')
        hlpWin.focus();
    }
    
    function doContinue( )
    {
    xF = document.forms['quickbooking'];
    xCountry = getListValue( xF.Country );
    xETADay = getListValue( xF.ETADay );
    xETAMonth = getListValue( xF.ETAMonth );
    xETAYear = getListValue( xF.ETAYear );
    xETAHour = getListValue( xF.ETAHour );
    xETAMinute = getListValue( xF.ETAMinute );
    xETA = xETADay + xMonths[ parseInt( xETAMonth )-1 ] + xETAYear.substr(2,2) + '/' + xETAHour + xETAMinute;xETTDay = getListValue( xF.ETTDay );
    xETTMonth = getListValue( xF.ETTMonth );
    xETTYear = getListValue( xF.ETTYear );
    xETTHour = getListValue( xF.ETTHour );
    xETTMinute = getListValue( xF.ETTMinute );
    xETT = xETTDay + xMonths[ parseInt( xETTMonth )-1 ] + xETTYear.substr(2,2) + '/' + xETTHour + xETTMinute;
    xWizardNumber = xF.wizard_number.value;
    xName = xF.surname.value ;
    xParams = '&CTR=' + xCountry +'&Country=' + xCountry + '&ETA=' + xETA + '&ETT=' + xETT+ '&CNAM=' + xName + '&WIZ=' + xWizardNumber+'&SOR=0038780x';
    url = 'http://book.rent-at-avis.com/avisonline/ibe.nsf/PrefillX?OpenAgent&ResStep=ReservationStep1&IBEOwner=EU&LNG=GB' + xParams;location.href = url;
    }
    window.onload = init;
    </script>
    Also note that the option value of "Lebanon" is selected: <option value="LB0" selected="selected">Lebanon</option>

    Thanks.
    Last edited by Snitz; 06-17-2009 at 02:56 PM.

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    javascript is case sensitive. Your element has the name country, not as you have used in javascript code Country

    By the way, you have also a third part javascript code error

    $("el-botsl") is null
    http://www.avis.com.lb/templates/el_...s/el.script.js
    Line 67


    It looks like you are using a framework (mootols)

    In other words, you have no element with the that id "el-botsl", nor that name, nor that className.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    Regular Coder
    Join Date
    Jul 2004
    Location
    Lebanon
    Posts
    223
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Kor View Post
    javascript is case sensitive. Your element has the name country, not as you have used in javascript code Country

    By the way, you have also a third part javascript code error

    $("el-botsl") is null
    http://www.avis.com.lb/templates/el_...s/el.script.js
    Line 67


    It looks like you are using a framework (mootols)

    In other words, you have no element with the that id "el-botsl", nor that name, nor that className.
    I did try changing my field name to Country instead of minor c but it didn't work.

    Here is from line 66 to 69 in el.script.js
    Code:
    function equalHeight(){
    	makeEqualHeight ($('el-botsl').getChildren());
    	makeEqualHeight ($$(['el-content','el-col1-bot','el-col2']));
    }
    And I can see in the template.css the id of el-botsl


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •