У меня есть набор переключателей. Я пытаюсь получить проверенное значение переключателя с помощью java-скрипта. Но у меня ошибка с нечетким идентификатором. Я делаю следующий код в html 5. Я не получаю значение.Как получить значение значка переключателя в javascript
function timeout()
{
if (document.getElementById["RadioButton1"].checked)
{
choice = document.getElementById["RadioButton1"].value;
alert('choice');
}
if (document.getElementById["RadioButton2"].checked)
{
choice = document.getElementById["RadioButton2"].value;
alert('choice');
}
if (document.getElementById["RadioButton3"].checked)
{
choice = document.getElementById["RadioButton3"].value;
alert('choice');
}
if (document.getElementById["RadioButton4"].checked)
{
choice = document.getElementById["RadioButton4"].value;
alert('choice');
}
var c = document.getElementById("label1").value;
}
http://stackoverflow.com/questions/3778206/how-to-i-get-the-value-of-a-radio-button-with-javascript –
в том, что я не получаю as. вот почему попросите снова –
что вы не получаете ?? вы даже не видите свои ошибки? –