Hi guys
I am totally new to javascript so excuse the crumby code....
I am trying to change the background color of an input box when a radio button is clicked.
I am successfully changing the text in the input box when the radio button is clicked but have no idea as to syntax to change color.
The input box controlname and text value are passed to the function which allows me to reuse the function.
I've tried
Any pointers
Many thanks in advance
TabbyTab
I am totally new to javascript so excuse the crumby code....
I am trying to change the background color of an input box when a radio button is clicked.
I am successfully changing the text in the input box when the radio button is clicked but have no idea as to syntax to change color.
The input box controlname and text value are passed to the function which allows me to reuse the function.
Code:
function J(QName,SelectedValue)
{
if (QName.substr(1,1) =="A")
eval('document.forms[0].RA'+(QName.substr(2,(QName.length)-2))+'.value=SelectedValue');
if (QName.substr(1,1) =="B")
eval('document.forms[0].RB'+(QName.substr(2,(QName.length)-2))+'.value=SelectedValue');
}
I've tried
Code:
function J(QName,SelectedValue)
{
if (QName.substr(1,1) =="A")
eval('document.forms[0].RA'+(QName.substr(2,(QName.length)-2))+'.value=SelectedValue');
eval('document.forms[0].RA'+(QName.substr(2,(QName.length)-2))+'.style.backgroundcolor="#000000"');
if (QName.substr(1,1) =="B")
eval('document.forms[0].RB'+(QName.substr(2,(QName.length)-2))+'.value=SelectedValue');
}
Any pointers
Many thanks in advance
TabbyTab