mercredi 17 octobre 2018

how to call javascript function with parameter from html?

I would like to call my javascript funcion from html but idk how,

Please help me,

This is my code:

<script type="text/javascript">
    (I WANT TO CALL THIS FUNCION)
    funtion condicionPci(val1){
            var PCI = '';

            if(val1<=100 && val1>=86){
                PCI = 'Excelente'; (result)
            }else if(val1<=85 && val1>=71){
                PCI = 'Muy Bueno';(result)
            }else if(val1<=70 && val1>=56){
                PCI = 'Bueno';(result)


            return PCI;(result)

        }
</script>

this is my HTML CODE and i want to call javascript with this foreach here im getting all parameter in my controler but i want to calculate pci with a js function but can't call it well idk

this is my body:

                    @foreach($p as $dpci)
                    <tr>
                        <td></td>

                        <td></td>
                        <td></td>
                        <td></td>
                        <td onload="condicionPci();"></td> 
                        (HERE A WANT TO CALL THE FUNCION BUT I WOULD LIKE TO 
                        SEND the parameter pcixpav)
                    </tr>
                    @endforeach



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire