Click to See Complete Forum and Search --> : Why won't this work?


DoyleRules
06-01-2003, 06:23 PM
What am I doing wrong?
I am trying to get the 2 radio buttons to toggle between changing the text color and the background color.
The following is my code:


<html>
<head>
<title>Test Document</title>
<style>
#div_1{
position:absolute;
left:124px;
top:150px;
display:block;
width:241px;
height:60px;
background-color:#999999;
border:2px black outset;
color:red;
font-weight:bold;
visibility:visible;
overflow:auto;
}
</style>
<SCRIPT LANGUAGE="JavaScript">
function colorPicker() {
var radioVal = document.TextBack.myRadio.value
if (radioVal = "TextColor"){
if ("TD"==event.srcElement.tagName)
if (document.all.Text.contains(event.srcElement))
document.getElementById("theText").style.color = event.srcElement.bgColor
}
else{
if ("TD"==event.srcElement.tagName)
if (document.all.Text.contains(event.srcElement))
document.bgColor = event.srcElement.bgColor
}
}
</script>
<body>
<div id="theText" align="center" style="font-size:10pt;width:80%">
<COMMENT>***BODY OF TEXT GOES BELOW HERE***</COMMENT>
THIS IS TEXT....
<COMMENT>***BODY OF TEXT ENDS HERE***</COMMENT>
</div>
<div id="div_1">
<center>
<table width="199" height="19" border="0" cellpadding="0" cellspacing="0" bordercolor="#000000" bgcolor="#999999">
<tr><td width="45" valign="top">
<font color="#FFFFFF"><strong>Color</strong></font>
</td><td width="174" align="right">
<form name="TextBack">
<input type="radio" name="myRadio" value="TextColor" CHECKED>
Font
<input type="radio" name="myRadio" value="Background">
Background</form>
</td></tr></table>
<TABLE STYLE="border-color:#000000" onClick="colorPicker()" BORDER=1 width="202" cellpadding="0" cellspacing="0" bgcolor="#000000" id="Text">
<TR>
<TD WIDTH="12" HEIGHT="12" BGCOLOR=red></TD>
<TD WIDTH="12" HEIGHT="12" BGCOLOR=green></TD>
<TD WIDTH="12" HEIGHT="12" BGCOLOR=blue></TD>
<TD WIDTH="12" HEIGHT="12" BGCOLOR=orange></TD>
<TD WIDTH="12" HEIGHT="12" BGCOLOR=white></TD>
<TD WIDTH="12" HEIGHT="12" BGCOLOR=black></TD>
</TR>
</TABLE>
</center>
</div>
</body>
</html>


Thanks ahead of time!!

DoyleRules
06-03-2003, 01:33 AM
Awesome, thanks soo much Dave!! You are the best!
Do you have a tutorial(s) you recommend for beginner programmers? I realize that some of this stuff should be easy, but being that I've only learned any of my programming knowledge from the web instead of having a mentor to bounce my questions off of, I have blank spaces in my mind about some of it. I wish there was something I could read that would tie it all together,

Thanks once again,