splinter: Suche Javascript Formel

Beitrag lesen

Hallo

----- Javascript -----

function rechnePreis() {
 var liste=document.getElementById("liste");
 var preis=liste.options[liste.selectedIndex].getAttribute("preis");
 var liste=document.getElementById("anzahl");
 var anzahl=liste.options[liste.selectedIndex].text;
 document.getElementById("preis").value=anzahl*preis;};

----- HTML -----

<select id="liste" onchange="rechnePreis()">
<option preis="10">Artikel 1</option>
<option preis="20">Artikel 2</option>
<option preis="30">Artikel 3</option>
</select>
<select id="anzahl" onchange="rechnePreis()">
<option>1</option>
<option>2</option>
<option>10</option>
</select>
<input type="text" id="preis" disabled="true" />

sollte einfach sein anzupassen.

MfG

Splinter