Syntax error:
<a href="javascript:onClick=pickChar('midge')">
<img src="midge.gif" width="117" height="117"></a><br/>
<input type="radio" name="radChars" value="midge" id="midge" <%if
varChar="midge" then%> checked <% end if %>>
Also, isn't the id attribute roughly equivalent to the name attribute.
I'm pretty sure they should both be the same if you're using both.
Greg
-----Original Message-----
From: michael robertson [mailto:mike@m...]
Sent: Friday, May 24, 2002 11:03 AM
To: javascript
Subject: [javascript] image checks radio button?
I'm not sure how to go about this correctly. In particular how to
target individual radio buttons in a group. I want to be to click on
an image and have it make a corresponding radio button in a group
checked. The following is what I've been trying and doesn't work. Any
suggestions?
<script language="JavaScript" type="text/javascript">
function pickChar(who){
if(!document.getElementById(who).checked){
document.getElementById(who).checked
}
}
</script>
<a href="javascript:;" onClick="pickChar(midge)">
<img src="midge.gif" width="117" height="117"></a><br/>
<input type="radio" name="radChars" value="midge" id="midge" <%if
varChar="midge" then%> checked <% end if %>>
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|| michael robertson
|| mike.e.media
|| website development & reparations
|| xxx.xxx.xxxx
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20