请帮忙解决一下,这个更换头像的代码是哪里出错了。。
这段代码输出后,性别不能选择“女”,我实在是看不出是什么地方出错了,感觉是那段JS代码的错,但是我实在不知道错在哪里,求高手指教。。。<html>
<head>
<title>更改图像</title>
</head>
<body>
<script language="javascript">
function change_sex(){
if(form1.sex.value="male"){
form1.malehead.style.display="block";
form1.femalehead.style.display="none";
form1.image.src="./head/6.gif";
}else if(form1.sex.value="female"){
form1.femalehead.style.display="block";
form1.malehead.style.display="none";
form1.image.src="./head/0.gif";
}
}
</script>
<form name="form1" method="post" action="2.php">
<table>
<tr>
<td>
性别:</td><td>
<select name="sex" onchange="javascript:change_sex();">
<option selected="selected" value="男女">请选择</option>
<option value="male" > 男</option>
<option value="female" > 女</option>
</select>
</td>
</tr>
<tr><td>头像:</td><td><img id="image" src="./head/0.gif" width="60" height="60"></td></tr>
<tr><td> </td><td>
<select name="femalehead" id="femalehead" onchange="form1.image.src=this.value" style="display:none">
<select name="malehead" id="malehead" onchange="form1.image.src=this.value" style="display:none">
<?php
for($i=0;$i<6;$i++){
?>
<option value="<?php echo ("./head/".($i+6).".gif");?>">头像<?php echo $i+7;?></option>
<?php } ?>
</select>
<?php
for($i=0;$i<6;$i++){
?>
<option value="<?php echo ("./head/".$i.".gif");?>">头像<?php echo $i+1;?></option>
<?php } ?>
</select>
</td>
</tr>
</table>
</form>
</body>
</html>