再请高手帮忙

dddd8888 2004-01-12 09:46:56
一个下拉框(内有 1, 2)
三个文本框 (1, 2)
选中1时, 文本框2变灰
选中2时, 文本框1变灰
...全文
44 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
仙人掌 2004-01-12
  • 打赏
  • 举报
回复
http://msdn.microsoft.com/workshop/author/css/css_node_entry.asp
dddd8888 2004-01-12
  • 打赏
  • 举报
回复
顺便问一下,有电子书查属性什么的吗?
aoenzh 2004-01-12
  • 打赏
  • 举报
回复
up
dddd8888 2004-01-12
  • 打赏
  • 举报
回复
真是太感谢 yeefly(Web开发版) 了,我是硬被逼着写JS,但又从来未接触过,
真是太感谢老大帮忙了
仙人掌 2004-01-12
  • 打赏
  • 举报
回复
<select name="slt" size="1" onchange="ddddd(this)">
<option selected>------</option>
<option>1</option>
<option>2</option>
</select>

<input type=text name=t1 value="111" size="22">
<input type=text name=t2 value="222" size="22">


<script language="javascript">
<!--
function ddddd(o)
{
switch(o.selectedIndex)
{
case 1 :
t1.readOnly = false;
t2.readOnly = true;
t1.style.backgroundColor= "";
t2.style.backgroundColor= "#C0C0C0";
break;
case 2 :
t1.readOnly = true;
t2.readOnly = false;
t1.style.backgroundColor= "#C0C0C0";
t2.style.backgroundColor= "";
break;
default :
t1.readOnly = false;
t2.readOnly = false;
t1.style.backgroundColor= "";
t2.style.backgroundColor= "";
break;
}

}
//-->
</script>
zhangxdd 2004-01-12
  • 打赏
  • 举报
回复
<body>
<p>
<select onchange="javascript:aa(this);">
<option value="1" selected >1</option>
<option value="2">2</option>
</select>
</p>
<input type="text" name="text1" value="AAAAAAAA"></input>
<input type="text" name="text2" value="BBBBBBBB"></input>
</body>
<script language="javascript">
function aa(obj){
alert(obj.value)
text1.readOnly=false
text2.readOnly=true
text1.disabled=true
text2.disabled=false
}

你再自己修改修改吧
dddd8888 2004-01-12
  • 打赏
  • 举报
回复
但我想同时把文本框的背景色变灰,同时把另一个的恢复。
恳请赐教
仙人掌 2004-01-12
  • 打赏
  • 举报
回复
<select name="slt" size="1" onchange="ddddd(this)">
<option selected>------</option>
<option>1</option>
<option>2</option>
</select>

<input type=text name=t1 value="111" size="22">
<input type=text name=t2 value="222" size="22">


<script language="javascript">
<!--
function ddddd(o)
{
switch(o.selectedIndex)
{
case 1 :
t1.disabled = false;
t2.disabled = true;
break;
case 2 :
t1.disabled = true;
t2.disabled = false;
break;
default :
t1.disabled = false;
t2.disabled = false;
break;
}

}
//-->
</script>

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧