Witam.

Mam problem z wywołaniem funkcji w Javie. Tzn po tym jak raz wcisnę przycisk w formularzu funkcja jest włączona przez cały czas i wydaje mi się, że wywoływana jest przy każdym odświeżeniu strony. A chodzi o to, żeby wywołana była tylko raz po naciśnięciu buttonu.

           <script type="text/javascript">
                function rolg_f()
                {
                    var temp=<PVI>ReadVar @/Pvi/LNINA2/TCPIP/WEB/CPU/rolety_zad</PVI>;

                    if(temp==0)
                    {document.forms['rolg'].Value.value=1;}

                    if(temp==1)
                    {document.forms['rolg'].Value.value=0;}
                    
                    if(temp==2)
                    {document.forms['rolg'].Value.value=0;}
                }
          </script>

          <FORM action="PviWrite" method="get" id="rolg" name="rolg">
                <input type=hidden name="Name" value="@/Pvi/LNINA2/TCPIP/WEB/CPU/rolety_zad">
                <input type=hidden name="Value">
                <input type=hidden name="Password" value="password">
                <input type=hidden name="ResponseUrl" value="index.html">
                <input type="submit" onclick="rolg_f()" class="button_bok" Value="">
          </FORM>
 
<script type="text/javascript">
                function rold_f()
                {
                    var temp=<PVI>ReadVar @/Pvi/LNINA2/TCPIP/WEB/CPU/rolety_zad</PVI>;

                    if(temp==0)
                    {document.forms['rold'].Value.value=2;}

                    if(temp==2)
                    {document.forms['rold'].Value.value=0;}
                    
                    if(temp==1)
                    {document.forms['rold'].Value.value=0;}
                }
          </script>

          <FORM action="PviWrite" method="get" id="rold" name="rold">
                <input type=hidden name="Name" value="@/Pvi/LNINA2/TCPIP/WEB/CPU/rolety_zad">
                <input type=hidden name="Value">
                <input type=hidden name="Password" value="password">
                <input type=hidden name="ResponseUrl" value="index.html">
                <input type="submit" onclick="rold_f()" class="button_bok" Value="">
          </FORM>