INPUT Radio Wert ermittlen
Hallo zusammen,
ich verwende folgenden Code um den Value des aktvierten Radio Felders zu ermitteln:
Habe ich mehrere Radio Felder so funktioniert der Code wunderbar.
<codel>
<ul style="padding-top: 5px; padding-bottom: 10px; padding-left: 20px; border-left: 1px solid rgb(211, 211, 211); border-bottom: 1px solid rgb(211, 211, 211);" id="material">
<li>
<label style="width: 210px; margin-top: 3px;">TEX-MESH B1</label>
<input type="radio" value="6" onclick="document.getElementById('price').innerHTML = '';document.getElementById('format').style.display='block';" id="productselector6" name="product" style="top:0;">
</li>
<li>
<label style="width: 210px; margin-top: 3px;">TEX-FLAG B1</label>
<input type="radio" value="5" onclick="document.getElementById('price').innerHTML = '';document.getElementById('format').style.display='block';" id="productselector5" name="product" style="top:0;">
</li>
<li>
<label style="width: 210px; margin-top: 3px;">TEX-DISPLAY B1</label>
<input type="radio" value="4" onclick="document.getElementById('price').innerHTML = '';document.getElementById('format').style.display='block';" id="productselector4" name="product" style="top:0;">
</li>
<li>
<label style="width: 210px; margin-top: 3px;">TEX-SATIN B1</label>
<input type="radio" value="7" onclick="document.getElementById('price').innerHTML = '';document.getElementById('format').style.display='block';" id="productselector7" name="product" style="top:0;">
</li>
</ul>
Sobald ich aber nur ein Radio Feld habe, liefert die Funktion false zurück.
Kann mir jmd sagen warum?
Danke
Gruß
ottscho
ich verwende folgenden Code um den Value des aktvierten Radio Felders zu ermitteln:
function radioWert(rObj) {
for (var i=0; i<rObj.length; i++) if (rObj[i].checked) return rObj[i].value;
return false;
}
alert(radioWert(document.sAddToBasket.product)));
Habe ich mehrere Radio Felder so funktioniert der Code wunderbar.
<codel>
<ul style="padding-top: 5px; padding-bottom: 10px; padding-left: 20px; border-left: 1px solid rgb(211, 211, 211); border-bottom: 1px solid rgb(211, 211, 211);" id="material">
<li>
<label style="width: 210px; margin-top: 3px;">TEX-MESH B1</label>
<input type="radio" value="6" onclick="document.getElementById('price').innerHTML = '';document.getElementById('format').style.display='block';" id="productselector6" name="product" style="top:0;">
</li>
<li>
<label style="width: 210px; margin-top: 3px;">TEX-FLAG B1</label>
<input type="radio" value="5" onclick="document.getElementById('price').innerHTML = '';document.getElementById('format').style.display='block';" id="productselector5" name="product" style="top:0;">
</li>
<li>
<label style="width: 210px; margin-top: 3px;">TEX-DISPLAY B1</label>
<input type="radio" value="4" onclick="document.getElementById('price').innerHTML = '';document.getElementById('format').style.display='block';" id="productselector4" name="product" style="top:0;">
</li>
<li>
<label style="width: 210px; margin-top: 3px;">TEX-SATIN B1</label>
<input type="radio" value="7" onclick="document.getElementById('price').innerHTML = '';document.getElementById('format').style.display='block';" id="productselector7" name="product" style="top:0;">
</li>
</ul>
Sobald ich aber nur ein Radio Feld habe, liefert die Funktion false zurück.
Kann mir jmd sagen warum?
Danke
Gruß
ottscho
Please also mark the comments that contributed to the solution of the article
Content-Key: 164908
Url: https://administrator.de/contentid/164908
Printed on: April 25, 2024 at 22:04 o'clock
2 Comments
Latest comment