i posted a question earlier and got it answerd thanks to the wonderful people here, but as my luck goes, its never that easy. i have a code that switches back and forth between pictures onclick, however, the first time you click, the picture doesnt switch, but the checkbox is checked. at the very least a reasoning would be superb :)
<script type="text/javascript">
function func()
{
var img1= document.getElementById("img1");
if(img1.name == "on")
{
img1.src = "images/" + "img1a.jpg";
img1.name = "off";
}
else
{
img1.src = "images/" + "img1.jpg";
img1.name = "on";
}
}
</script>
</head>
<body>
<form>
<p align="center">
<input type="checkbox" name="interest1" id="interest1" value="x">
<input type="checkbox" name="interest2" id="interest2" value="x">
<input type="checkbox" name="interest3" id="interest3" value="x"></p>
<p align="center">
<label for="interest1" id="label-interest1"><img src="images/img1.jpg" width="781" height="800" onclick="func()" id="img1" /></label>
<label for="interest2" id="label-interest2"><img src="/images/img2.jpg" width="781" height="800" /></label>
<label for="interest3" id="label-interest3"><img src="/images/img3.jpg" width="781" height="800" /></label></P><!-- code making checkbox be an image-->
</form>
func()is ran, nonameproperty exists, so theelseblock is executed, which sets thesrcto what it's already set to. Either swap which image is assigned in each block, or addname="on"by default...