J'ai ce code dans le HEAD:Avez-vous la réponse JavaScript calculer dans une zone de texte, pas une fenêtre pop-up!
<script LANGUAGE="JavaScript">
<!--
function calculate(form)
{
height = eval(form.height.value)
width = eval(form.width.value)
photos = eval(form.photos.value)
lgtext = eval(form.lgtext.value)
mountlam = eval(form.mount.value)
mountlam = eval(form.lam.value)
GetPriceOne (form, height, width, photos, lgtext, mount, lam)
}
function GetPriceOne(form, height, width, photos, lgtext, mount, lam)
{
PriceOne = height * width
GetPriceTwo(form, height, width, photos, lgtext, mount, lam, PriceOne)
}
function GetPriceTwo(form, height, width, photos, lgtext, mount, lam, PriceOne)
{
PriceTwo = PriceOne/144
GetPriceThree(form, height, width, photos, lgtext, mount, lam, PriceTwo)
}
function GetPriceThree(form, height, width, photos, lgtext, mount, lam, PriceTwo)
{
PriceThree = PriceTwo * 15
GetPriceFour(form, height, width, photos, lgtext, mount, lam, PriceThree)
}
function GetPriceFour(form, height, width, photos, lgtext, mount, lam, PriceThree)
{
if(form.lgtext.checked)
{
PriceFour = PriceThree + 20
GetPriceFive(form, height, width, photos, lgtext, mount, lam, PriceFour)
}
else
{
PriceFour = PriceThree
GetPriceFive(form, height, width, photos, lgtext, mount, lam, PriceFour)
}
}
function GetPriceFive(form, height, width, photos, lgtext, mount, lam, PriceFour)
{
if(form.mount.checked)
{
PriceFive = PriceFour + PriceTwo * 5
GetPriceSix(form, height, width, photos, lgtext, mount, lam, PriceFive)
}
else
{
PriceFive = PriceFour
GetPriceSix(form, height, width, photos, lgtext, mount, lam, PriceFive)
}
}
function GetPriceSix(form, height, width, photos, lgtext, mount, lam, PriceFive)
{
if(form.lam.checked)
{
PriceSix = PriceFive + PriceTwo * 5
GetPriceSeven(form, height, width, photos, lgtext, mount, lam, PriceSix)
}
else
{
PriceSix = PriceFive
GetPriceSeven(form, height, width, photos, lgtext, mount, lam, PriceSix)
}
}
function GetPriceSeven(form, height, width, photos, lgtext, mount, lam, PriceSix)
{
total = (photos * 4.95) + PriceSix
WriteDocument(total)
}
function RoundToPennies(n)
{
pennies = n * 100;
pennies = Math.round(pennies);
strPennies = "" + pennies;
len = strPennies.length;
return strPennies.substring(0, len - 2) + "." + strPennies.substring(len - 2, len);
}
function WriteDocument(total)
{
alert("Estimated price of this collage is ONLY $" + RoundToPennies(total))
}
//-->
</script>
Si je veux qu'il aille dans cette zone de texte, qu'est-ce que je dois faire à la fonction?
<INPUT TYPE = Text NAME = "collageEstimate" SIZE = 25 />
<input type="button" value="Calculate Estimate" name="B1" onclick="calculate(this.form)" />
Aidez-nous! J'ai été à cela pendant des heures et j'ai essayé tout ce que je sais !!! Voici la page réelle maintenant, en collaboration avec l'alerte-popup: http://procollage.com/site10/pricing/photo-collage-pricing.html
Ne placez jamais d'espaces entre le nom de l'attribut et sa valeur. Ce n'est pas un code HTML valide. Et s'il vous plaît, choisissez un boîtier - ne passez pas entre ALL CAPS, tout en minuscules, et PascalCase. – zneak
SinonKnownAsCamelCase – nickf
merci pour cela –