日期:2014-05-17  浏览次数:21027 次

在下拉菜单中控制文本是否可以输入
我想在一个填写表单中实现:
-----------------------------------|
|填写A     |填写B     |下拉菜单                     |
------------------------------------
|填写C     |填写D     |                                     |
------------------------------------
一般情况下,C,D的值为灰色,可以看到,不能操作,但通过下拉菜单的特定选项实现可以填写,应怎么实现????

------解决方案--------------------
用下拉菜单中的onchange方法不行吗?
------解决方案--------------------
在下拉菜单select的onchange事件里调用一个javascript函数 让这个函数控制C,D的readonly属性就可以了
------解决方案--------------------
看一下是不是这个意思。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 " />
<title> 无标题文档 </title>
<style type= "text/css ">
td,body,input{
font-size:12px;
}
</style>
</head>

<body>
<table width= "600 " border= "0 " cellspacing= "1 " cellpadding= "0 ">
<form name= "form1 " action= " " method= "post ">
<tr>
<td width= "62 " height= "30 " align= "center "> 姓名: </td>
<td width= "121 " height= "30 " align= "center "> <input name= "textfield " type= "text " size= "15 " maxlength= "15 " /> </td>
<td width= "65 " height= "30 " align= "center "> 年龄: </td>
<td width= "126 " height= "30 " align= "center "> <input name= "textfield2 " type= "text " size= "15 " maxlength= "15 " /> </td>
<td width= "110 " height= "30 " align= "center "> 更改学历地址: </td>
<td width= "109 " height= "30 " align= "center "> <select name= "sel " onchange= "change() ">
<option value= " " selected= "selected "> 请选择 </option>
<option value= "add "> 更改学历地址 </option>
</select>
</td>
</tr>
<tr>
<td height= "30 " align= "center "> 学历: </td>
<td height= "30 " align= "center "> <input name= "xueli " type= "text " disabled= "disabled " value= "学历 " size= "15 " maxlength= "15 " /> </td>
<td height= "30 " align= "center "> 地址: </td>
<td height= "30 " align= "center "> <input name= "address " type= "text " disabled= "disabled " value= "地址 " size= "15 " maxlength= "15 "/> </td>
<td height= "30 " align= "center "> &nbsp; </td>
<td height= "30 " align= "center "> &nbsp; </td>
</tr>
<tr>
<td height= "30 " align= "center "> &nbsp; </td>