<tr>
<td valign="top" class="field-right field_text" >国家(地区): <font color="#830413" size="3">*</font></td>
<td><!--DWLayoutEmptyCell--> </td>
<td>
<select name="countryID" id="country_id" class="input_select" onchange="locationWIndow(this.value);"> <?php
echo fill_combo_Co("country", "Country", "Country", "Country", "1=1", "Chile", "");
?>
</select> </td>
</tr>
<tr id="tr_zipcode">
<td valign="top" class="field-right field_text">邮政编码: <font color="#830413" size="3">*</font></td>
<td><!--DWLayoutEmptyCell--> </td>
<td>
<input name="zipcode" id="zipcode" type="text" class="input_select" onblur="FetchDetails(this.value);" maxlength="5" style="width: 150px;"></td>
</tr>
有一个下来框和一个输入框,下拉框为某个值的时候想让输入框zipcode 为不可输入,其他值可输入。
然后我在locationWIndow函数里面这样写的: function locationWIndow(cntry){
if(cntry!='Unites States'){
document.getElementById('zipcode').readonly = "readonly";
}
}但是不其作用,请问该怎样实现,多谢。
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function ro()
{
document.getElementById('a').readOnly = !document.getElementById('a').readOnly;
}
//-->
</SCRIPT>
<BODY>
<INPUT TYPE="text" NAME="a" id="a">
<input type="button" name="asdf" id="asdf" value="asdf" onclick="ro()">
</BODY>
</HTML>
搞定了,多谢