在表单中编辑数据希望在表单中显示...但不应选择下拉值...我希望选择下拉值这里是 list_search 函数中的代码 id return cmb_fruit, val return Apple or Orange
<tr>
<td width="38%" height="28" align="left"><span class="style20"><font color="#DC143C">*</font>Profession</span></td>
<td width="62%" align="left"><label for="profession"></label>
<select name="cmb_fruit" size="1" id="cmb_fruit">
<option value="Select">Select</option>
<option value="Apple">Apple</option>
<option value="Orange">Orange</option>
</select>
<script language="javascript" type="text/javascript">
list_search('cmb_fruit',<?php echo "'" . @mysql_result($rs_modify,0,'fruit') . "'";?>)
</script>
</td>
</tr>
function list_search(id,val)
{
cnt=document.getElementById(id).length
for(x=0; x<cnt; x++ )
{
if( document.getElementById(id).options(x).value==val)
{
document.getElementById(id).options(x).selected=true
break;
}
}
}