![]() |
Formularz - mały problem - Wersja do druku +- Forum Webmastera, HTML, CSS, PHP, MySQL, Hosting, Domeny - Forum dla Webmasterów (https://www.webmastertalk.pl) +-- Dział: Technologie internetowe - tworzenie stron WWW (https://www.webmastertalk.pl/forum-technologie-internetowe-tworzenie-stron-www) +--- Dział: Początkujący webmaster (https://www.webmastertalk.pl/forum-poczatkujacy-webmaster) +--- Wątek: Formularz - mały problem (/thread-formularz-maly-problem) |
Formularz - mały problem - art-e - 31-10-2009 Witam Mam na stronie mały formularz gdzie wpisuje dane do wykonania płatności on-line i z niego jest przekierowanie na stronę operatora płatności. Jak zrobić aby po wpisaniu w pole kwota do zapłaty i po przejściu na stronę już operatora podana kwota w formularzu była powiększona o 3%. Pod spodem kod: <script> function p24_findObj(n, d) { var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=p24_findObj(n,d.layers[i].document); if(!x && document.getElementById) x=document.getElementById(n); return x; } function p24_kwota2gr(pole_zl,pole_gr) { var error='', ret=true; obj_zl = p24_findObj(pole_zl); obj_gr = p24_findObj(pole_gr); if (obj_zl.value=='' || isNaN(obj_zl.value)) { error += '-Nieprawidłowa wartość w polu Kwota-ZŁ\n'; ret = false; } if (obj_gr.value != '' && isNaN(obj_gr.value)) { error += '-Nieprawidłowa wartość w polu Kwota-GR\n'; ret = false; } else { if(obj_gr.value.length == 0) obj_gr.value='00'; if(obj_gr.value.length == 1) obj_gr.value=obj_gr.value+'0'; } if(ret == false) { alert("Błędy wypełniania formularza!\n"+error); } else { val = p24_findObj('z24_kwota'); val.value = obj_zl.value+''+obj_gr.value; } return ret; } </script> <form method="get" action="http://xxxxxxxxxxxxx" onsubmit="return p24_kwota2gr('kwota_zl','kwota_gr');"> <input type="hidden" name="z24_id_sprzedawcy" value="xxxxxxxx"> <input type="hidden" name="z24_return_url" value="xxxxxxxxxxxxxx"> <input type="hidden" name="z24_kwota" value=""> <table width="100%" border="0" cellpadding="5" cellspacing="0"> <tr> <td width="25%" align="right">Imię i nazwisko: </td> <td><input type="text" name="k24_nazwa" value="" style="width: 250px;" /></td> </tr> <tr> <td width="25%" align="right">Adres e-mail: </td> <td><input type="text" name="k24_email" value="" style="width: 250px;" /></td> </tr> <tr> <td width="25%" align="right">Tytuł wpłaty: </td> <td><input type="text" name="z24_nazwa" value="" style="width: 250px;" /></td> </tr> <tr> <td width="25%" align="right">Dodatkowe informacje: </td> <td><textarea name="z24_opis" style="width: 400px; height: 100px;"></textarea></td> </tr> <tr> <td width="25%" align="right">Kwota wpłaty: </td> <td><input type="text" name="kwota_zl" maxlength="5" size="3" /> zł, <input type="text" name="kwota_gr" maxlength="2" size="1" /> gr</td> </tr> <tr> <td width="25%" align="right"></td> <td><input type="submit" value="przejdź dalej" /></td> </tr> </table> Pozdrawiam Artur |