Potrzebuję do tego "elektryki", ponieważ nie działa. Stworzyłem coś takiego, chciałbym, aby zaczęło mi to działać - pole RESET czyści, OBLICZ wylicza koszty ...
Mam do tego coś takiego:
Kod: Zaznacz cały
<SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
function adCalc(form) {
var ok = 0;
var cost = form.cost.value;
var cpm = form.cpm.value;
var exposures = form.exposures.value;
var complete = "It looks like you entered all the information already! With this calculator, you just enter two of the fields and it solves for the last one.";
var incomplete = "Oops! It doesn't appear you entered enough information. Please enter at least two entries in order to solve for the other two.";
if (cost != "" && cpm != "") { form.exposures.value = ((cost / cpm) * 1000); ok++; } // solve for exposures
if (cost != "" && exposures != "") { form.cpm.value = ((1000 / exposures) * cost); ok++; } // solve for cpm
if (cpm != "" && exposures != "") { form.cost.value = cpm / (1000 / exposures); ok++; } // solve for cost
if (!ok) alert(incomplete); // they did not enter at least 2 fields
if (cost != "" && cpm != "" && exposures != "") alert(complete); // they filled in all the fields!
}
// End -->
</script>
Kod: Zaznacz cały
<center>
<form method=post>
<table border="1" cellpadding=5>
<tr>
<td align=center>Koszt:</td>
<td align=center><input type=text name=cost size=6 value="" onFocus="select()"></td>
</tr>
<td colspan="2">...</td>
<tr>
<td align=center>Ilość:</td>
<td align=center><input type=text name=cpm size=6 value="" onFocus="select()"></td>
</tr>
<tr>
<td align=center>Cena:</td>
<td align=center><input type=text name=exposures size=6 value="" onFocus="select()"></td>
</tr>
<tr>
<td colspan=2 align=center><input type=button value="Solve" onClick="adCalc(this.form)"> <input type=reset value=reset></td>
</tr>
</table>
</form>
</center>
Ps. Puste pole przed polem OBLICZ to pole, w które wpisuję ilość danej "usługi" - później klik na OBLICZ i powinna ukazać się cena, później klik na RESET i czyściutko.
Sam nie dam rady.
Pozdrawiam i liczę na jakąkolwiek pomoc przy tworzeniu tego cuda.