PDA

View Full Version : A little bit of more onChange problems...


Fou-Lu
09-30-2002, 10:32 PM
Hi, I posted here with an onChange problem a few weeks ago, that was resolved due to the quick replies from a few members. I was hoping that I could get some help again. Basically, the forums that I am running, I allow members to choose their font coloring, but have found that recently some of the color choices are very difficult to read in a few of the themes. So I am making a new script that allows our members to choose different colors for each theme. This is a dynamic script and adds more options as more themes are available. Anyway, the big problem that I am having once again, is the javascript onchange, so that a member can see what the coloring is that they are selecting. Here is the code:

<SCRIPT ID=clientEventHandlersJS LAUNGUAGE=javascript>
<!--
function color4(){
change4.innerHTML = '<span style="position:relative"><font color=' + myform.colorchange4.value + '>Test This Color</font></span>';
}
function color1(){
change1.innerHTML = '<span style="position:relative"><font color=' + myform.colorchange1.value + '>Test This Color</font></span>';
}
function color5(){
change5.innerHTML = '<span style="position:relative"><font color=' + myform.colorchange5.value + '>Test This Color</font></span>';
}

//-->
</script></head>
<body bgcolor="#818EB0" text="#000000" id="all" leftmargin="10" topmargin="10" marginwidth="10" marginheight="10" link="#000020" vlink="#000020" alink="#000020"><form name="myform">
<table width=95% cellpadding=0 cellspacing=0 colspan=2 border=1 bordercolor=#5A6C91>
<tr width=100% colspan=2>
<td width="*" bgcolor="#224388">
<font face="verdana, arial, helvetica" size="2" ><font color="#eeeeee">Deep Blue</font></font></td> <td bgcolor="#224388"><font face="verdana,arial,helvetica" size="1" align=right><font color="#eeeeee"><span id="change4">Test This Color</span></font></td>
<td bgcolor="#335499"><font face="verdana,arial,helvetica" size="1" align=left><Span id=change4><font color="#eeeeee">Test This Color</font></span></td>
<td bgcolor="#335499"><div align=right>
<select id="colorchange4" name="color" onChange="color4"><option value="" price="5"> None </option>


Width more options of course. There are also more colorchange#'s, and change#. The numbers are to relate to the themes that they are being driven on. The thing is, that this code looks right to me, and I do not get any errors, I just don't get an effect. If anyone could help me, that would be great! You can check out the actual source here (http://www.gamers-forums.com/vb/theme_fonts.php), but you would have to log in: Tester Password:hiddenfromview

You guys have been very helpful in the past, and I am hoping that you can give me a hand with this one too...

Owl
09-30-2002, 11:39 PM
Hi Fou-Lu,

onChange="color4()"

( •) (• )
>>V

Fou-Lu
10-01-2002, 09:39 AM
Thanx for pointing that out Owl! But that still didn't solve the problem. Any other suggestions?

glenngv
10-01-2002, 09:53 AM
name not id:

<select name="colorchange4" name="color" onChange="color4()">

Alekz
10-01-2002, 09:56 AM
Hi,
Try like this:
<font color=' + myform.colorchange4.options[myform.colorchange4.selectedIndex].value....

A select form field have no value - it's a property of an option element...

Alex

Fou-Lu
10-01-2002, 10:04 AM
Awesome! It took a little bit of code change, but it seems to work fine now! Thanks very much!

glenngv
10-01-2002, 10:06 AM
Originally posted by Alekz
Hi,
Try like this:
<font color=' + myform.colorchange4.options[myform.colorchange4.selectedIndex].value....

A select form field have no value - it's a property of an option element...

Alex

it does work with IE though it's not the proper way of getting the value of a select.