Pagina 2 di 2 primaprima 1 2
Visualizzazione dei risultati da 11 a 16 su 16

Discussione: funzione su firefox

  1. #11
    Originariamente inviato da whisher
    Mi sa proprio che sbagli qc perchè ho provato il codice
    solamente su FF devi mettere un a cosa del genere

    Codice PHP:
    <input name="chk_title[]"  onclick="checkMe(this,'mio');" type="checkbox" value="4" /> 
    Ps.
    mio è l'id del form

    post doppio matinaccia
    Without faith, nothing is possible. With it, nothing is impossible
    http://ilwebdifabio.it

  2. #12
    Utente di HTML.it L'avatar di kodode
    Registrato dal
    Sep 2002
    Messaggi
    1,896
    io usavo

    <input type="checkbox" name="select_all_chk" class="checkbox" value="" onClick="checkMe(this,'form_medi');">

    poi l'ho sostituito con quello che mi fai detto tu

    <input type="checkbox" name="chk_title[]" value="4" onclick="checkMe(this,'form_medi');" />

    ma niente... ho aggiunto quindi un alert alla funzione :

    function checkMe (pItem, pForm) {
    alert ("sono dentro la funzione checkMe ");
    var _form= document.getElementById(pForm);
    if (pItem.checked) {
    for (var i=0;i< _form.elements.length;i++) {
    if (document.getElementById(pForm).elements[i].name.substring(0,4) == "chk_") {
    document.getElementById(pForm).elements[i].checked = true;
    }
    }
    } else {
    // Deseleziona tutto
    for (var i=0;i< _form.elements.length;i++) {
    if (document.getElementById(pForm).elements[i].name.substring(0,4) == "chk_") {
    document.getElementById(pForm).elements[i].checked = false;
    }
    }

    }
    }

    e l'alert lo visualizzo si con ie che con ff . L'ho quindi spostato più sotto:

    function checkMe (pItem, pForm) {
    var _form= document.getElementById(pForm);
    if (pItem.checked) {
    for (var i=0; i< _form.elements.length; i++) {
    alert ("sono dentro "+document.getElementById(pForm).elements[i].name.substring(0,4));

    if (document.getElementById(pForm).elements[i].name.substring(0,4) == "chk_") {
    document.getElementById(pForm).elements[i].checked = true;
    }
    }
    } else {
    // Deseleziona tutto
    for (var i=0;i< _form.elements.length;i++) {
    if (document.getElementById(pForm).elements[i].name.substring(0,4) == "chk_") {
    document.getElementById(pForm).elements[i].checked = false;
    }
    }
    }
    }

    con ie funziona con ff no dove sbaglio?? da te funziona??

  3. #13
    Codice PHP:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css">
    *{ 
        margin:0px; 
        padding:0px
    }
    input,textarea{ 
        width:150px
    }
    textarea{ 
        height:150px 
    }
    </style>

    <script language="JavaScript" type="text/JavaScript">
    function checkMe (pItem, pForm) {
    var _form= document.getElementById(pForm);
    if (pItem.checked) {
        for (var i=0;i< _form.elements.length;i++) {
            if (_form.elements[i].name.substring(0,4) == "chk_") {
                _form.elements[i].checked = true;
            }
        }
    } else {
    // Deseleziona tutto
        for (var i=0;i< _form.elements.length;i++) {
            if (_form.elements[i].name.substring(0,4) == "chk_") {
                _form.elements[i].checked = false;
            }
        }
    }
    }

    </script>

    </head>

    <body>
    <form action="indexForum.php" method="post" name="frm" id="mio">
    <input name="check_from" type="hidden" value="<?php echo time();?>" />
    <input name="chk_title[]"  onclick="checkMe(this,'mio');" type="checkbox"  value="1" />

    <input name="chk_title[]"  onclick="checkMe(this,'mio');" type="checkbox" value="2" />

    <input name="chk_title[]"  onclick="checkMe(this,'mio');" type="checkbox" value="3" />

    <input name="chk_title[]"  onclick="checkMe(this,'mio');" type="checkbox" value="4" />

    <input name="save_item" onclick="" type="submit" value="Save" />
    </form>
    </body>
    </html>
    Without faith, nothing is possible. With it, nothing is impossible
    http://ilwebdifabio.it

  4. #14
    Utente di HTML.it L'avatar di kodode
    Registrato dal
    Sep 2002
    Messaggi
    1,896
    scusa se insisto ma

    questo funziona (con FF)

    function checkMe (pItem, pForm) {
    var _form= document.getElementById(pForm);
    alert ("sono dentro la funzione " );
    }

    e questo no...

    function checkMe (pItem, pForm) {
    var _form= document.getElementById(pForm);
    alert ("sono dentro la funzione "+_form.elements.length );
    }

  5. #15
    Utente di HTML.it L'avatar di kodode
    Registrato dal
    Sep 2002
    Messaggi
    1,896
    infatti mettendo
    alert ("sono dentro alla funzione "+document.getElementById(pForm) );

    FF mi restituisce

    sono dentro alla funzione null

    invece di

    sono dentro alla funzione [object]


  6. #16
    Utente di HTML.it L'avatar di kodode
    Registrato dal
    Sep 2002
    Messaggi
    1,896
    funzia!!!!!!

    era una c...ata nel form c'era solo "name" non l' "id"


    grazie whisher

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.