N
Nick Wedd
I have an html page with some javascript that outputs text to a <td>
element. This works. Here is the element:
<td rowspan=2 valign=top id="out" class=op bgColor="white"></td>
I want to let the user change the appearance of this text, so I have
provided some buttons:
<tr><td>
Output colour:
</td><td>
<input type=radio name=c checked
onclick="document.getElementById('out').bgColor = 'yellow';">yellow
<input type=radio name=c
onclick="document.getElementById('out').bgColor = 'blue';">blue
</td></tr>
<tr><td>
Output size:
</td><td>
<input type=radio name=s checked
onclick="document.getElementById('out').style.font-size =
'large';">large
<input type=radio name=s
onclick="document.getElementById('out').style.font-size =
'small';">small
</td></tr>
<tr><td>
Output font:
</td><td>
<input type=radio name=f checked
onclick="document.getElementById('out').style.fontFamily =
'serif';">serif
<input type=radio name=f
onclick="document.getElementById('out').style.font.fontFamily =
'sans-serif';">sans-serif
</td></tr>
Clicking on the "yellow" button changes the background of
the <td> to yellow.
Clicking on the "blue" button changes the background of
the <td> to blue.
Clicking on the "large" button does nothing.
Clicking on the "small" button does nothing.
Clicking on the "serif" button changes the text to a serif font.
Clicking on the "sans-serif" button does nothing.
Obviously I am doing something wrong. It seems likely that I am
making a simple and obvious mistake. But I can't think why three
of these buttons do what I intended, while three do nothing. Can
anyone please help?
Nick
element. This works. Here is the element:
<td rowspan=2 valign=top id="out" class=op bgColor="white"></td>
I want to let the user change the appearance of this text, so I have
provided some buttons:
<tr><td>
Output colour:
</td><td>
<input type=radio name=c checked
onclick="document.getElementById('out').bgColor = 'yellow';">yellow
<input type=radio name=c
onclick="document.getElementById('out').bgColor = 'blue';">blue
</td></tr>
<tr><td>
Output size:
</td><td>
<input type=radio name=s checked
onclick="document.getElementById('out').style.font-size =
'large';">large
<input type=radio name=s
onclick="document.getElementById('out').style.font-size =
'small';">small
</td></tr>
<tr><td>
Output font:
</td><td>
<input type=radio name=f checked
onclick="document.getElementById('out').style.fontFamily =
'serif';">serif
<input type=radio name=f
onclick="document.getElementById('out').style.font.fontFamily =
'sans-serif';">sans-serif
</td></tr>
Clicking on the "yellow" button changes the background of
the <td> to yellow.
Clicking on the "blue" button changes the background of
the <td> to blue.
Clicking on the "large" button does nothing.
Clicking on the "small" button does nothing.
Clicking on the "serif" button changes the text to a serif font.
Clicking on the "sans-serif" button does nothing.
Obviously I am doing something wrong. It seems likely that I am
making a simple and obvious mistake. But I can't think why three
of these buttons do what I intended, while three do nothing. Can
anyone please help?
Nick