Ir para conteúdo
Fórum Script Brasil
  • 0

Vcs Sabem?


Guest - Paloma -

Pergunta

Guest - Paloma -

Olá pessoal!!! Sou nova aqui no fórum e estou desesperada. Comecei estudar agora JavaScript e ainda estou super confusa. Gostaria que alguém me ajudasse por favor. No código abaixo eu tenho que somar os valores correspondidos de Radio! Mas estou muito embolada e não consigo fazer essa proeza. Acho muito complicado. Alguém poderia me ajudar??? Ficaria muitíssima grata!!!!

<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&oacute;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&iacute;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>
&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="checkbox5" value="checkbox"> 
 Home Teather (5.1)
 </label>R$ 200,00 <label><br>
    &nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="checkbox6" value="checkbox"> 
 Web Cam / Microfone / Fone de Ouvido&nbsp;
</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&nbsp;<br>
&nbsp;
</p>
<p><strong>Valor Total:</strong>        
      <input type="text" name="textfield5">
</p>

</form>
</body>
</head>
</html>

Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

  • 0
Guest - Paloma -

Oi gente. Olhem só!!! To aqui desde aquela hora e consegui maior parte do trabalho e restou uma coisa a ser feita: SOMA DOS RADIOS SELECIONADOS. Consegui que apareça o valor correspondente de cada radio, mas não consigo soma-los. alguém poderia fazer essa função pra mim??? Só peço isso. Por favor. é a última coisa a ser feita. Por favor me ajudem!!!

<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 &nbsp;&nbsp;&nbsp;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&nbsp;&nbsp;&nbsp; 
        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 &nbsp;&nbsp;&nbsp;
        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 &nbsp;&nbsp;&nbsp;R$ 835,00</label>
</p>
<p>Mem&oacute;ria:<label><br><input type="radio" name="256" onclick="this.form.total.value=checkChoice(this);" value="100">
 256 Mb &nbsp;&nbsp;&nbsp;</label>R$ 100,00 
        <br>
        <label>
        <input type="radio" name="512" onclick="this.form.total.value=checkChoice(this);" value="170">
        512
        Mb
</label>&nbsp;&nbsp;&nbsp;R$ 170,00
        <br>
        <label>
        <input type="radio" name="1" onclick="this.form.total.value=checkChoice(this);" value="330">
        1 Gb</label>

&nbsp;&nbsp;&nbsp;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>&nbsp;&nbsp;&nbsp;R$ 180,00<br>
<input type="radio" name="80" onclick="this.form.total.value=checkChoice(this);" value="250">
 80 Gb
&nbsp;&nbsp;&nbsp; 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
&nbsp;&nbsp;&nbsp;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
&nbsp;&nbsp;&nbsp;R$ 800,00 / 1100,00
</p>
<p>Placa de V&iacute;deo: <label><br><input type="radio" name="gf128" onclick="this.form.total.value=checkChoice(this);" value="150">
 GEForce 128 Mb
 </label>&nbsp;&nbsp;&nbsp;R$ 150,00 <br>

<label><input type="radio" name="gf256" id="gf256" onclick="this.form.total.value=checkChoice(this);" value="300">
 GEForce 256 Mb
&nbsp;&nbsp;&nbsp;</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>&nbsp;&nbsp;&nbsp;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&nbsp;
</label>&nbsp;&nbsp;&nbsp;R$ 110,00
</p>
<p>Gravador:
<label><br><input type="radio" name="cd" onclick="this.form.total.value=checkChoice(this);" value="90">
 CD
 </label>&nbsp;&nbsp;&nbsp;R$ 90,00<label><br>
</label>
 <label><input type="radio" name="dvd" onclick="this.form.total.value=checkChoice(this);" value="160">
 DVD
</label>&nbsp;&nbsp;&nbsp;R$ 160,00&nbsp;<br>
&nbsp;
</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>

Link para o comentário
Compartilhar em outros sites

  • 0

<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(hiddentotal.value) + eval(whichbox.value)

return(hiddentotal.value);

}

}

</script>

<style type="text/css">

<!--

.style1 {

font-size: 22px;

font-weight: bold;

}

body{font-size: 12px;}

-->

</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="proc" onclick="this.form.total.value=checkChoice(this);" value="350">

AMD Athlon XP 3.2 OEM &nbsp;&nbsp;&nbsp;R$ 350,00</label>

      <br>

      <label>

      <input type="radio" name="proc" onclick="this.form.total.value=checkChoice(this);" value="435">

      AMD Athlon 64 3.0 OEM&nbsp;&nbsp;&nbsp;

      R$ 435,00</label>

      <br>

      <label>

      <input type="radio" name="proc" onclick="this.form.total.value=checkChoice(this);" value="520">

      Intel Pentium 4 2.4 &nbsp;&nbsp;&nbsp;

      R$ 520,00</label>

      <br>

<label>

      <input type="radio" name="proc" onclick="this.form.total.value=checkChoice(this);" value="835">

Intel Pentium 4 3.4 HT Prescott &nbsp;&nbsp;&nbsp;R$ 835,00</label>

</p>

<p>Mem&oacute;ria:<label><br><input type="radio" name="mem" onclick="this.form.total.value=checkChoice(this);" value="100">

256 Mb &nbsp;&nbsp;&nbsp;</label>R$ 100,00

      <br>

      <label>

      <input type="radio" name="mem" onclick="this.form.total.value=checkChoice(this);" value="170">

      512

      Mb

</label>&nbsp;&nbsp;&nbsp;R$ 170,00

      <br>

      <label>

      <input type="radio" name="mem" onclick="this.form.total.value=checkChoice(this);" value="330">

      1 Gb</label>

&nbsp;&nbsp;&nbsp;R$ 330,00

</p>

<p>HD:

<label><br><input type="radio" name="hd" onclick="this.form.total.value=checkChoice(this);" value="180">

40 Gb

</label>&nbsp;&nbsp;&nbsp;R$ 180,00<br>

<input type="radio" name="hd" onclick="this.form.total.value=checkChoice(this);" value="250">

80 Gb

&nbsp;&nbsp;&nbsp; R$ 250,00

</p>

<p>Monitor:

<br>

CRT

        <input type="radio" name="mon" onclick="this.form.total.value=checkChoice(this);" value="300">

15 polegadas

        <input type="radio"  name="mon" onclick="this.form.total.value=checkChoice(this);" value="350">

      17 polegadas

&nbsp;&nbsp;&nbsp;R$ 300,00 / 350,00 <br>

LCD

      <input type="radio" name="mon" onclick="this.form.total.value=checkChoice(this);" value="800">

15 polegadas

      <input type="radio" name="mon" onclick="this.form.total.value=checkChoice(this);" value="1100">

      17 polegada

&nbsp;&nbsp;&nbsp;R$ 800,00 / 1100,00

</p>

<p>Placa de V&iacute;deo: <label><br><input type="radio" name="vid" onclick="this.form.total.value=checkChoice(this);" value="150">

GEForce 128 Mb

</label>&nbsp;&nbsp;&nbsp;R$ 150,00 <br>

<label><input type="radio" name="vid" id="gf256" onclick="this.form.total.value=checkChoice(this);" value="300">

GEForce 256 Mb

&nbsp;&nbsp;&nbsp;</label>R$ 300,00<label>

  <br>

<input type="radio" name="vid" id="ht" onclick="this.form.total.value=checkChoice(this);" value="200" >

Home Teather (5.1)

</label>&nbsp;&nbsp;&nbsp;R$ 200,00 <label><br>

  <input type="radio" name="vid" id="wc" onclick="this.form.total.value=checkChoice(this);" value="110" >

Web Cam / Microfone / Fone de Ouvido&nbsp;

</label>&nbsp;&nbsp;&nbsp;R$ 110,00

</p>

<p>Gravador:

<label><br><input type="radio" name="grav" onclick="this.form.total.value=checkChoice(this);" value="90">

CD

</label>&nbsp;&nbsp;&nbsp;R$ 90,00<label><br>

</label>

<label><input type="radio" name="grav" onclick="this.form.total.value=checkChoice(this);" value="160">

DVD

</label>&nbsp;&nbsp;&nbsp;R$ 160,00&nbsp;<br>

&nbsp;

</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>

faz um teste ae

abraços

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,2k
    • Posts
      651,9k
×
×
  • Criar Novo...