Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
Javascript - Change BG Color with Radio Buttons
SUBMITTED BY:
Guest
DATE:
Aug. 2, 2013, 7:25 p.m.
FORMAT:
JavaScript
SIZE:
651 Bytes
Raw
Download
Tweet
HITS:
1294
Go to comments
Report
<!
DOCTYPE
html
>
<
html
>
<
head
>
<
title
><
/title>
<
script
>
function
changeBG
(
color
)
{
document
.
body
.
style
.
backgroundColor
=
color
;
}
<
/script>
<
/head>
<
body
>
<
input
type
=
"radio"
name
=
"bgcolor"
value
=
"red"
onclick
=
"changeBG('Red');"">Red<br />
<input type="
radio
" name="
bgcolor
" value="
blue
" onclick="
changeBG
(
'Blue'
);
">Blue<br />
<input type="
radio
" name="
bgcolor
" value="
green
" onclick="
changeBG
(
'Green'
);
">Green<br />
<input type="
radio
" name="
bgcolor
" value="
yellow
" onclick="
changeBG
(
'Yellow'
);
"
>
Yellow
<
/body>
<
/html>
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus