I am wondering if it is possible to make a div that behaves exactly like a switch? I try to achieve this without using jquery, which many people offer, I checked the network and found it.
my previous way of doing this with javascript, this works for a small number
function Switcher(a,b,c,d,e){ document.getElementById('button1').style.background=a; document.getElementById('button2').style.background=b; document.getElementById('button3').style.background=c; document.getElementById('button4').style.background=d; document.getElementById('button5').style.background=e; }
with onclick event
onClick="Switcher(#c5e043,#241009,#241009,#241009,#241009)"
then each button pressed is switched, I can add a switch test function, but I notice that I may need up to 20, which makes the list very long.
I am wondering if anyone has a simpler solution to this problem? Basically I need a div that behaves like a switch that changes bgcolor or smthg when selected (radio also)
Crays source share