我想根据单选框的选择,变换不同的LOGO,不知以下代码错在哪里?<DIV class=search-form>
<DIV class=search-logo><A href="http://www.google.com"><IMG id=searchlogo src="css/google.png"></A></DIV><FORM id=searchform  onsubmit="return checkinput(searchform);" action="" method=post><INPUT class=text id=terms name=terms><BUTTON class=button type=submit name=sou>搜索</BUTTON><SPAN>
<LABEL>
<INPUT onclick="changesearch("google");" type=radio CHECKED value=1 name=r><SPAN>谷歌</SPAN></LABEL> 
<LABEL>
<INPUT onclick="changesearch("youdao");" type=radio value=2 name=r><SPAN>有道</SPAN></LABEL> 
<LABEL>
<INPUT onclick="changesearch("taobao");" type=radio value=3 name=r><SPAN>淘宝</SPAN></LABEL> 
</SPAN>
</FORM><SCRIPT language=javascript> 
function $(id){
         return document.getElementById(id);
}function changesearch(a){
 $('searchlogo').src="css/" + a + ".png";             
 return false;
}
</SCRIPT>

解决方案 »

  1.   

    双引号匹配问题!大写的标签看着真不舒服
    <span>
    <label>
    <input onclick="changesearch('google');" type="radio" checked="checked" value="1" name="r"><span>谷歌</span>
    </label>  
    <label>
    <input onclick="changesearch('youdao');" type="radio" value="2" name="r"><span>有道</span>
    </label>  
    <label>
    <input onclick="changesearch('taobao');" type="radio" value="3" name="r"><span>淘宝</span>
    </label> 
    </span>