Hey,
ich brauche hilfe bei einer Sache. Nämlich habe ich in meinem Bestellformular 4 Checkboxen. Ich möchte das wenn man eine Checkbox klickt , dass dann in einem span element der Preis ausgegeben wird. Und wenn man weitere Checkboxen klickt, dass der Preis dann addiert wird.
Mein HTML & CSS:
HTML
<div id="bestellformular">
<div id="bestellformular-mover-in">
<p id="uberschrift">Was möchten sie bestellen?</p>
<form name="bestellform">
<label for="angebot1" >Bilder</label>
<input type="checkbox" id="angebot1" />
<br>
<label for="angebot2" >Videos</label>
<input type="checkbox" id="angebot2" />
<br>
<label for="angebot3">E-Book</label>
<input type="checkbox" id="angebot3" />
<br>
<label for="angebot4" >Buch</label>
<input type="checkbox" id="angebot4"/>
<button id="bestellbutton">Bestellen!</button>
</form>
<p>Es kostet:<span id="preis"></span></p>
</div>
<p>B<br>E<br>S<br>T<br>E<br>L<br>L<br>F
<br>O<br>R<br>M<br>U<br>L<br>A<br>R<br></p>
</div>
Alles anzeigen
Code
[COLOR=#236E26]/*Bestellformular*/[/COLOR]
div#bestellformular
{
[COLOR=#87154F]width[/COLOR]: [COLOR=#1906FD]50px[/COLOR];
[COLOR=#87154F]height[/COLOR]: [COLOR=#1906FD]400px[/COLOR];
[COLOR=#87154F]background-color[/COLOR]: brown;
[COLOR=#87154F]border[/COLOR]: [COLOR=#1906FD]2px[/COLOR] [COLOR=#994509]solid[/COLOR] cyan;
[COLOR=#87154F]border-right[/COLOR]: [COLOR=#994509]none[/COLOR];
[COLOR=#87154F]float[/COLOR]: [COLOR=#87154F][COLOR=#994509]right[/COLOR][/COLOR];
border-top-left-radius: [COLOR=#1906FD]30px[/COLOR];
border-bottom-left-radius: [COLOR=#1906FD]30px[/COLOR];
[COLOR=#87154F]clear[/COLOR]: [COLOR=#994509]both[/COLOR];
}
div#bestellformular p
{
[COLOR=#87154F]position[/COLOR]: [COLOR=#994509]absolute[/COLOR];
[COLOR=#87154F][COLOR=#994509]right[/COLOR][/COLOR]: [COLOR=#1906FD]10px[/COLOR];
[COLOR=#87154F][COLOR=#994509]top[/COLOR][/COLOR]: [COLOR=#1906FD]160px[/COLOR];
[COLOR=#87154F]font-weight[/COLOR]: [COLOR=#1906FD]900[/COLOR];
[COLOR=#87154F]color[/COLOR]: black;
}
#bestellformular div#bestellformular-mover-in
{
[COLOR=#87154F]width[/COLOR]: [COLOR=#1906FD]200px[/COLOR];
[COLOR=#87154F]height[/COLOR]: [COLOR=#1906FD]430px[/COLOR];
[COLOR=#87154F]background-color[/COLOR]: yellow;
[COLOR=#87154F]position[/COLOR]: [COLOR=#994509]relative[/COLOR];
[COLOR=#87154F][COLOR=#994509]right[/COLOR][/COLOR]: [COLOR=#1906FD]150px[/COLOR];
[COLOR=#87154F][COLOR=#994509]top[/COLOR][/COLOR]: [COLOR=#1906FD]-5px[/COLOR];
border-top-left-radius: [COLOR=#1906FD]30px[/COLOR];
border-bottom-left-radius: [COLOR=#1906FD]30px[/COLOR];
[COLOR=#87154F]z-index[/COLOR]: [COLOR=#1906FD]1[/COLOR];
}
div#bestellformular-mover-in p#uberschrift
{
[COLOR=#87154F]position[/COLOR]: [COLOR=#994509]absolute[/COLOR];
[COLOR=#87154F][COLOR=#994509]top[/COLOR][/COLOR]: [COLOR=#1906FD]10px[/COLOR];
[COLOR=#87154F][COLOR=#994509]left[/COLOR][/COLOR]: [COLOR=#1906FD]10px[/COLOR];
}
div#bestellformular-mover-in p
{
[COLOR=#87154F]position[/COLOR]: [COLOR=#994509]absolute[/COLOR];
[COLOR=#87154F][COLOR=#994509]top[/COLOR][/COLOR]: [COLOR=#1906FD]230px[/COLOR];
[COLOR=#87154F][COLOR=#994509]left[/COLOR][/COLOR]: [COLOR=#1906FD]10px[/COLOR];
}
div#bestellformular-mover-in p span
{
[COLOR=#87154F]width[/COLOR]: [COLOR=#1906FD]100px[/COLOR];
[COLOR=#87154F]height[/COLOR]: [COLOR=#1906FD]50px[/COLOR];
[COLOR=#87154F]border[/COLOR]: [COLOR=#1906FD]2px[/COLOR] [COLOR=#994509]solid[/COLOR] black;
[COLOR=#87154F]margin-left[/COLOR]: [COLOR=#1906FD]5px[/COLOR];
[COLOR=#87154F]padding[/COLOR]: [COLOR=#1906FD]3px[/COLOR] [COLOR=#1906FD]4px[/COLOR] [COLOR=#1906FD]3px[/COLOR] [COLOR=#1906FD]4px[/COLOR];
}
div#bestellformular-mover-in label
{
[COLOR=#87154F]position[/COLOR]: [COLOR=#994509]relative[/COLOR];
[COLOR=#87154F][COLOR=#994509]top[/COLOR][/COLOR]: [COLOR=#1906FD]80px[/COLOR];
[COLOR=#87154F][COLOR=#994509]left[/COLOR][/COLOR]: [COLOR=#1906FD]40px[/COLOR];
[COLOR=#87154F]display[/COLOR]: [COLOR=#994509]block[/COLOR];
}
div#bestellformular-mover-in [type=[COLOR=red]"checkbox"[/COLOR]]
{
[COLOR=#87154F]position[/COLOR]: [COLOR=#994509]relative[/COLOR];
[COLOR=#87154F][COLOR=#994509]top[/COLOR][/COLOR]: [COLOR=#1906FD]65px[/COLOR];
[COLOR=#87154F][COLOR=#994509]left[/COLOR][/COLOR]: [COLOR=#1906FD]25px[/COLOR];
}
div#bestellformular-mover-in button
{
[COLOR=#87154F]position[/COLOR]: [COLOR=#994509]absolute[/COLOR];
[COLOR=#87154F][COLOR=#994509]top[/COLOR][/COLOR]: [COLOR=#1906FD]300px[/COLOR];
[COLOR=#87154F][COLOR=#994509]left[/COLOR][/COLOR]: [COLOR=#1906FD]20px[/COLOR];
[COLOR=#87154F]padding[/COLOR]: [COLOR=#1906FD]10px[/COLOR];
[COLOR=#87154F]border[/COLOR]: [COLOR=#1906FD]3px[/COLOR] [COLOR=#994509]solid[/COLOR] cyan;
}
[COLOR=#236E26]/*Zeigen dieses Bereiches + hover-effekte*/[/COLOR]
div#bestellformular-mover-in button:hover
{
[COLOR=#87154F]background-color[/COLOR]: rgba(0, 234, 255, 0.3);
[COLOR=#87154F]cursor[/COLOR]: [COLOR=#994509]pointer[/COLOR];
}
#bestellformular div#bestellformular-mover-in
{
[COLOR=#87154F]display[/COLOR]: [COLOR=#994509]none[/COLOR];
}
div#bestellformular:hover #bestellformular-mover-in
{
[COLOR=#87154F]display[/COLOR]: [COLOR=#994509]block[/COLOR];
}
Alles anzeigen
Ich habe im internet schon geschaut aber das was ich gefunden habe, hat entweder nicht funktioniert oder das erklärte hab ich nicht verstanden.
Freue mich auf eure Hilfe.
Stef