Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 16

Discussione: funzione su firefox

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

    funzione su firefox

    ciao a tutti!

    questa funzione su ie funziona ma su ff no...

    function checkMe (pItem, pForm) {
    if (pItem.checked) {
    // Seleziona tutto
    for (i in document.getElementById(pForm).elements) {
    if (i.substring(0,4) == "chk_") {
    document.getElementById(pForm)[i].checked = true;
    }
    }
    } else {
    // Deseleziona tutto
    for (i in document.getElementById(pForm).elements) {
    if (i.substring(0,4) == "chk_") {
    document.getElementById(pForm)[i].checked = false;
    }
    }
    }
    }

    qualche idea?

  2. #2
    A parte che hai sbagliato forum
    Cq

    document.getElementById(pForm)[i].checked = true;



    solatamente il ciclo for in
    si usa in questa maniera

    for(var prop in obj){}


    E' un mistero di come possa funzionare
    su IE.


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

  3. #3
    Utente di HTML.it L'avatar di kodode
    Registrato dal
    Sep 2002
    Messaggi
    1,896
    document.getElementById(pForm)[i].checked = true;

    mi serve per conporre l'esatto nome del checkbox...


    il ciclo for è preso da un'applicazione in ASP, però l'ho presa per buona e vedo funziona anche in PHP

    tu che suggerisci?

  4. #4
    Posta l'xhtml




    Ps.

    Immagino a che cosa possa servire
    la funzione ma se ce lo dici è meglio.
    Without faith, nothing is possible. With it, nothing is impossible
    http://ilwebdifabio.it

  5. #5
    Utente di HTML.it L'avatar di kodode
    Registrato dal
    Sep 2002
    Messaggi
    1,896
    grazie....

  6. #6
    Codice PHP:
    document.getElementById(pForm)[i].checked false
    ad occhio va sostituito con


    Codice PHP:
    document.getElementById(pForm).elements[i].checked false
    Without faith, nothing is possible. With it, nothing is impossible
    http://ilwebdifabio.it

  7. #7
    A scopo puramente didattico

    Codice PHP:
    function checkMe (pItempForm) {
    var 
    _formdocument.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;
            }
        }
    }


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

  8. #8
    Utente di HTML.it L'avatar di kodode
    Registrato dal
    Sep 2002
    Messaggi
    1,896
    però nn funziona neache cosi su FF... ok posto su xhtml

  9. #9
    Utente di HTML.it L'avatar di kodode
    Registrato dal
    Sep 2002
    Messaggi
    1,896
    oops... mi avevano già spostato su javascript

  10. #10
    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" /> 
    Without faith, nothing is possible. With it, nothing is impossible
    http://ilwebdifabio.it

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 © 2025 vBulletin Solutions, Inc. All rights reserved.