Ana Sayfa
ASP.Net Kütüphanesi
ASP Kütüphanesi
Javascript Kütüphanesi
SQL Server 2008
Excel Araçları
Search Engines
Web Forms
Uncheck Radio Button
Simple Ajax Combo
Ana Sayfa
Javascript Kütüphanesi
Web Forms
Ana Sayfa
Javascript Kütüphanesi
Web Forms
Uncheck Radio Button
Dili:
Javascript
How to check and uncheck Radio Buttons like checkboxes.
[benzer sayfalar]
<
SCRIPT
TYPE
=
"text/javascript"
>
var
isChecked
=
false
;
var
lastRadio
=
null;
var
lastField
=
null;
function
cy
(
theField
)
{
var
objForm
=
document
.
forms[0]
;
if
(
theField
==
lastField
)
{
for
(
var
i
=
0
;
i
<
theField
.
length
;
i
++)
{
if
(
objForm
.
elements
[theField][i]
.
checked
==
true
&&
isChecked
&&
lastRadio
==
i
)
{
objForm
.
elements
[theField][i]
.
checked
=
false
;
isChecked
=
false
;
lastRadio
=
i
;
break
;
}
else
if
(
objForm
.
elements
[theField][i]
.
checked
==
true
)
{
objForm
.
elements
[theField][i]
.
checked
=
true
;
isChecked
=
true
;
lastRadio
=
i
;
break
;
}
}
}
else
{
lastField
=
theField
;
for
(
var
i
=
0
;
i
<
theField
.
length
;
i
++)
{
if
(
objForm
.
elements
[theField][i]
.
checked
==
true
)
{
objForm
.
elements
[theField][i]
.
checked
=
true
;
isChecked
=
true
;
lastRadio
=
i
;
break
;
}
}
}
}
</
SCRIPT
>
<
FORM NAME
=
"myForm"
>
1
:
<
INPUT
TYPE
=
"radio" NAME
=
"myField" onclick
=
"cy('myField');"
>
<
INPUT
TYPE
=
"radio" NAME
=
"myField" onclick
=
"cy('myField');"
>
<
INPUT
TYPE
=
"radio" NAME
=
"myField" onclick
=
"cy('myField');"
>
<
hr
>
2
:
<
INPUT
TYPE
=
"radio" NAME
=
"myField2" onclick
=
"cy('myField2');"
>
<
INPUT
TYPE
=
"radio" NAME
=
"myField2" onclick
=
"cy('myField2');"
>
<
INPUT
TYPE
=
"radio" NAME
=
"myField2" onclick
=
"cy('myField2');"
>
</
FORM
>
Üye Girişi
|
İletişim