<html> <head> <title>Venda de Computadores</title> <body> <form> <b><span style="font-family: Comic Sans MS;"> Dados do Computador </span> </b> <p> <b>Processador:<label><br><input type="radio" name="RadioGroup1" value="radio"> AMD Athlon XP 3.2 OEM R$ 350,00</label> <br> <label> <input type="radio" name="RadioGroup1" value="radio"> AMD Athlon 64 3.0 OEM R$ 435,00</label> <br> <label> <input type="radio" name="RadioGroup1" value="radio"> Intel Pentium 4 2.4 R$ 520,00</label> <br> <label> <input type="radio" name="RadioGroup1" value="radio"> Intel Pentium 4 3.4 HT Prescott R$ 835,00</label> </p> <p>Memória:<label><br><input type="radio" name="RadioGroup2" value="radio"> 256 Mb </label>R$ 100,00 <br> <label> <input type="radio" name="RadioGroup2" value="radio"> 512 Mb </label>R$ 170,00 <br> <label> <input type="radio" name="RadioGroup2" value="radio"> 1 Gb</label> R$ 330,00 </p> <p>HD: <label><br><input type="radio" name="RadioGroup3" value="radio"> 40 Gb </label>R$ 180,00<br> <label><input type="radio" name="RadioGroup3" value="radio"> 80 Gb </label>R$ 250,00 </p> <p>Monitor: <label><br><input type="radio" name="RadioGroup4" value="radio"> CRT</label> <input type="checkbox" name="checkbox" value="checkbox"> 15 polegadas <input type="checkbox" name="checkbox2" value="checkbox"> 17 polegadas R$ 300,00 / 350,00 <br> <label><input type="radio" name="RadioGroup4" value="radio"> LCD</label> <input type="checkbox" name="checkbox3" value="checkbox"> 15 polegadas <input type="checkbox" name="checkbox4" value="checkbox"> 17 polegada R$ 800,00 / 1100,00 </p> <p>Placa de Vídeo: <label><br><input type="radio" name="RadioGroup5" value="radio"> GEForce 128 Mb </label>R$ 150,00 <label><br> </label <label><input type="radio" name="RadioGroup5" value="radio"> GEForce 256 Mb </label>R$ 300,00<label> <br> <input type="checkbox" name="checkbox5" value="checkbox"> Home Teather (5.1) </label>R$ 200,00 <label><br> <input type="checkbox" name="checkbox6" value="checkbox"> Web Cam / Microfone / Fone de Ouvido </label>R$ 110,00 </p> <p>Gravador: <label><br><input type="radio" name="RadioGroup6" value="radio"> CD </label>R$ 90,00<label><br> </label> <label><input type="radio" name="RadioGroup6" value="radio"> DVD </label>R$ 160,00 <br> </p> <p><strong>Valor Total:</strong> <input type="text" name="textfield5"> </p> </form> </body> </head> </html>

Fácil?
Started By Vitor Gomes, 26/03/2006, 16:13
1 reply to this topic
#1
Posted 26/03/2006, 16:13
Olá pessoal!!! Comecei estudar a pouco tempo JavaScript e ainda estou muito confuso. Gostaria que alguém me ajudasse por favor. No código abaixo eu tenho que somar os valores correspondidos no campo Radio e depois mostrar o valor todas de todos os campos selecionados! Mas estou muito embolado e não consigo fazer essa proeza... rsrsr. Acho muito complicado. Alguém poderia me ajudar??? Obrigado!!!
#2
Posted 26/03/2006, 18:04
Consegui fazer algumas coisas, mas restou o principal: SOMAR OS RADIOS SELECIONADOS. Só consigo mostrar o valor correspondente de cada rádio. Será que alguém poderia me ajudar com essa função. Não deve ser díficil... ou é??? Por favor me ajudem. Quero muito apredner.
<html> <head> <title>Venda de Computadores</title> <script language="JavaScript"> function checkChoice(whichbox) { with (whichbox.form) { if (whichbox.checked == false) hiddentotal.value = eval(hiddentotal.value) - eval(whichbox.value); else hiddentotal.value = eval(whichbox.value) return(hiddentotal.value); } } </script> <style type="text/css"> <!-- .style1 { font-size: 22px; font-weight: bold; } --> </style> </head> <body> <form name="enviar_formulario" onsubmit="return enviar();"> <b><span style="font-family: Comic Sans MS;"> Dados do Computador </span> </b> <p> <b>Processador:<label><br><input type="radio" name="amd32" onclick="this.form.total.value=checkChoice(this);" value="350"> AMD Athlon XP 3.2 OEM R$ 350,00</label> <br> <label> <input type="radio" name="amd64" onclick="this.form.total.value=checkChoice(this);" value="435"> AMD Athlon 64 3.0 OEM R$ 435,00</label> <br> <label> <input type="radio" name="p4" onclick="this.form.total.value=checkChoice(this);" value="520"> Intel Pentium 4 2.4 R$ 520,00</label> <br> <label> <input type="radio" name="p4ht" onclick="this.form.total.value=checkChoice(this);" value="835"> Intel Pentium 4 3.4 HT Prescott R$ 835,00</label> </p> <p>Memória:<label><br><input type="radio" name="256" onclick="this.form.total.value=checkChoice(this);" value="100"> 256 Mb </label>R$ 100,00 <br> <label> <input type="radio" name="512" onclick="this.form.total.value=checkChoice(this);" value="170"> 512 Mb </label> R$ 170,00 <br> <label> <input type="radio" name="1" onclick="this.form.total.value=checkChoice(this);" value="330"> 1 Gb</label> R$ 330,00 </p> <p>HD: <label><br><input type="radio" name="40" onclick="this.form.total.value=checkChoice(this);" value="180"> 40 Gb </label> R$ 180,00<br> <input type="radio" name="80" onclick="this.form.total.value=checkChoice(this);" value="250"> 80 Gb R$ 250,00 </p> <p>Monitor: <br> CRT <input type="radio" name="15" onclick="this.form.total.value=checkChoice(this);" value="300"> 15 polegadas <input type="radio" name="17" onclick="this.form.total.value=checkChoice(this);" value="350"> 17 polegadas R$ 300,00 / 350,00 <br> LCD <input type="radio" name="15p" onclick="this.form.total.value=checkChoice(this);" value="800"> 15 polegadas <input type="radio" name="17p" onclick="this.form.total.value=checkChoice(this);" value="1100"> 17 polegada R$ 800,00 / 1100,00 </p> <p>Placa de Vídeo: <label><br><input type="radio" name="gf128" onclick="this.form.total.value=checkChoice(this);" value="150"> GEForce 128 Mb </label> R$ 150,00 <br> <label><input type="radio" name="gf256" id="gf256" onclick="this.form.total.value=checkChoice(this);" value="300"> GEForce 256 Mb </label>R$ 300,00<label> <br> <input type="radio" name="ht" id="ht" onclick="this.form.total.value=checkChoice(this);" value="200" > Home Teather (5.1) </label> R$ 200,00 <label><br> <input type="radio" name="wc" id="wc" onclick="this.form.total.value=checkChoice(this);" value="110" > Web Cam / Microfone / Fone de Ouvido </label> R$ 110,00 </p> <p>Gravador: <label><br><input type="radio" name="cd" onclick="this.form.total.value=checkChoice(this);" value="90"> CD </label> R$ 90,00<label><br> </label> <label><input type="radio" name="dvd" onclick="this.form.total.value=checkChoice(this);" value="160"> DVD </label> R$ 160,00 <br> </p> <p><strong>Valor Total:</strong> <input readonly="readonly" size="10" name="total"><input value="0" name="hiddentotal" type="hidden"> </p> <p><input name="Enviar" value="Enviar" type="submit"> <input name="limpar" id="limpar" value="Limpar" type="reset"></p> </form> </body> </html>
1 user(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)