hi..
I am trying to change the font color when the checkbox is clicked.
this code works, but..
if I just want to change color of list (selection) boxes and it remains two text fields...
how can I do that??
thank you in advance..
---
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"
<html>
<head>
<title>Untitled</title>
<style type="text/css">
.readOnly { color: black; }
.readWrite { color: white; }
</style>
<script language="javascript"><!--
function SetState( bool, targ ) {
targ.readOnly = !bool;
SetColor( bool, targ );
}
function SetColor( bool, targ, flag ) {
targ.className = (bool) ? 'readOnly':'readWrite';
if (flag) SetColor( bool, targ );
<!--'readWrite' : -->
}
//--></script>
</head>
<body>
<form name="f">
<td><input type="checkbox" name="cb1" onclick="SetState(this.checked, this.form.t2, false); SetState(this.checked, this.form.t3, false);SetState(!this.checked, this.form.t1, true); SetState(!this.checked, this.form.t4, true);" /></td>
<td>
<select name="t1" class="readOnly">
<option>aa</option>
<option>ab</option>
<option>ac</option>
</select>
<!--<input type="text" name="t1" value ="a" class="readOnly" /></td>-->
<td><input type="text" name="t2" value ="b" readonly /></td>
<td><input type="text" name="t3" value ="c" readonly /></td>
<td><select name="t1" class="readOnly">
<option>a</option>
<option>b</option>
<option>c</option>
</select></td>
</form>
</body>
</html>
I am trying to change the font color when the checkbox is clicked.
this code works, but..
if I just want to change color of list (selection) boxes and it remains two text fields...
how can I do that??
thank you in advance..
---
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"
<html>
<head>
<title>Untitled</title>
<style type="text/css">
.readOnly { color: black; }
.readWrite { color: white; }
</style>
<script language="javascript"><!--
function SetState( bool, targ ) {
targ.readOnly = !bool;
SetColor( bool, targ );
}
function SetColor( bool, targ, flag ) {
targ.className = (bool) ? 'readOnly':'readWrite';
if (flag) SetColor( bool, targ );
<!--'readWrite' : -->
}
//--></script>
</head>
<body>
<form name="f">
<td><input type="checkbox" name="cb1" onclick="SetState(this.checked, this.form.t2, false); SetState(this.checked, this.form.t3, false);SetState(!this.checked, this.form.t1, true); SetState(!this.checked, this.form.t4, true);" /></td>
<td>
<select name="t1" class="readOnly">
<option>aa</option>
<option>ab</option>
<option>ac</option>
</select>
<!--<input type="text" name="t1" value ="a" class="readOnly" /></td>-->
<td><input type="text" name="t2" value ="b" readonly /></td>
<td><input type="text" name="t3" value ="c" readonly /></td>
<td><select name="t1" class="readOnly">
<option>a</option>
<option>b</option>
<option>c</option>
</select></td>
</form>
</body>
</html>