Something Wrong? IE works but Firefox ...

Discussion in 'Javascript' started by alvarojaviervera@gmail.com, May 6, 2007.

  1. Guest

    Allways I think Firefox was strong, enough ... and so far THE BEST Web-
    browser (That what I Think) but, now Im fighting with it, may be Im
    doing something wrong (of course that is what happend to me)

    ....
    <script LANGUAGE="JavaScript">
    <!--
    var msg1="";
    var msg2="";
    function Mostrar(valor)
    {
    var
    msg1=window.document.formulario2.seccionA.options[formulario2.seccionA.selectedIndex].value;
    var
    msg2=window.document.formulario2.proveedorA.options[formulario2.proveedorA.selectedIndex].value;
    var seccion='&seccion=' + msg1;
    var proveedor='&proveedor=' + msg2;
    location.replace(valor + seccion + proveedor);
    }
    //-->
    </script>
    <tr>
    <td bgcolor="#cedfea"><div style="position:relative;top:8px;left:
    35px; float:left;z-index:2;" class="titulos1">Detalle</div>
    <div style="position:relative;top:0px;left:-30px;z-index:
    1;float:left"><img src="../global/img/fondo_titulo2.gif" alt=""
    border="0"></div>
    <div style="position:relative;top:3px;left:30px;z-index:
    1;float:left">
    <form action="nada" method="GET" name="formulario2"
    id="formulario2">
    <select name="seccionA" style="width:150px;padding:
    2px;height:17px;">
    <!-- BEGIN option1 -->
    <option value={valopt1}>{opt1}</option>
    <!-- END option1 -->
    </select>
    </div>
    <div style="position:relative;top:3px;left:50px;z-index:
    1;float:left">
    <select name="proveedorA" style="width:150px;padding:2px;height:
    17px;">
    <!-- BEGIN option2 -->
    <option value={valopt2}>{opt2}</option>
    <!-- END option2 -->
    </select>
    </form>
    </div>
    <div style="float:right; margin-top:4px;"><A
    href="javascript:Mostrar('{additem}');"><img src="../global/img/
    agregar.jpg" alt="" width="26" height="20" border="0" style="margin-
    right:4px;"></a><A href="{delitem}"><img src="../global/img/
    eliminar.jpg" alt="" width="26" height="20" border="0" style="margin-
    right:4px;"></A><A href="{refresh}"><img src="../global/img/ok.jpg"
    alt="" width="26" height="20" border="0" style="margin-right:4px;"></
    A></div></td>
    </tr>

    Ok, I´ll try to explain what does do that. (My english is very WEAK)
    now Im using some TPL - Pear functions. My idea is take a pair of html
    - select - options to send a selection of this to a PHP (for update
    old info). (Nothing AJAX yet I hope soon implement something about
    this if you know some easy and good manual tell me - I was googling
    for everywhere but I just sink)
    Between <BEGIN option1> and <END option1> (the same with option2) I
    load a pair of value.
    With var {refresh}I send my PHP file catcher. Is where data will sent.

    So, I just use JScript to click in A Href to call a JScript function
    for make a redirect to my PHP. with this two parameters.
    This Kind of code work in IExplorer 6 and 7, but in my Dear Firefox
    didn´t, do you know why? Thanks for your support!
    Alvaro J. Vera.-
    , May 6, 2007
    #1
    1. Advertising

  2. On May 6, 1:00 am, ""
    <> wrote:
    > Allways I think Firefox was strong, enough ... and so far THE BEST Web-
    > browser (That what I Think) but, now Im fighting with it, may be Im
    > doing something wrong (of course that is what happend to me)


    > <script LANGUAGE="JavaScript">


    Unless you are working with HTML 3.2, which would be a very odd
    choice, your HTML is invalid. Broken HTML is a shaky foundation to
    build JavaScript on.

    > <!--


    These comments are worthless today, they're there to hide the JS from
    Netscape 2 era browsers.

    > var msg1="";
    > var msg2="";
    > function Mostrar(valor)
    > {
    > var msg1


    You have a variable called msg1 in the global scope (an empty string)
    and now you create another one scoped to this function. Are you sure
    you want to do that?

    > =window.document.formulario2.seccionA.options[


    Most people leave the "window" off that. I'd also suggest using:

    document.forms['forumulario2'].elements['seccionA'].options for
    clarity.

    > formulario2.seccionA.selectedIndex].value;


    formulario2 is undefined here... but the JavaScript console (or
    Firebug) on Firefox should have told you that.

    > </script>
    > <tr>


    I take it back. You aren't writing HTML 3.2, that is just plain
    invalid. Use a validator.
    http://validator.w3.org/
    David Dorward, May 6, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kees Hoogendijk

    something wrong in function, but what?

    Kees Hoogendijk, Dec 27, 2003, in forum: C++
    Replies:
    3
    Views:
    333
    Martijn Lievaart
    Dec 30, 2003
  2. Aidan
    Replies:
    4
    Views:
    496
    Neredbojias
    Jun 7, 2007
  3. RichardOnRails
    Replies:
    1
    Views:
    952
    RichardOnRails
    Mar 12, 2010
  4. Replies:
    1
    Views:
    165
    Miki Tebeka
    Oct 14, 2011
  5. Replies:
    8
    Views:
    222
    Randy Webb
    Jan 13, 2006
Loading...

Share This Page