zoukankan
html css js c++ java
js代码控制dropdownList
<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"
>
<
html
>
<
head
>
<
title
></
title
>
<
script
language
="JavaScript"
type
="text/javascript"
>
<!--
//
by Vic Phillips http://www.vicsjavascripts.org.uk
//
elements in the form are numbered from the top 0 to
//
The select option value specifies the element numbers to disable separated by '^'
function
Select(f,s)
{
el
=
f.elements;
for
(i
=
0
;i
<
el.length;i
++
)
{
//
el[i].style.visibility='visible';
el[i].removeAttribute('disabled');
}
if
(s.selectedIndex
<
1
)
{
return
; }
selop
=
s.options[s.selectedIndex].value.split('
^
');
for
(i
=
0
;i
<
selop.length;i
++
)
{
if
(el[selop[i]])
{
//
el[selop[i]].style.visibility='hidden';
el[selop[i]].setAttribute('disabled','disabled');
}
}
}
function
Radio(f,s)
{
el
=
f.elements;
for
(i
=
0
;i
<
el.length;i
++
)
{
//
el[i].style.visibility='visible';
el[i].removeAttribute('disabled');
}
if
(s.selectedIndex
<
1
)
{
return
; }
selop
=
s.value.split('
^
');
for
(i
=
0
;i
<
selop.length;i
++
)
{
if
(el[selop[i]])
{
//
el[selop[i]].style.visibility='hidden';
el[selop[i]].setAttribute('disabled','disabled');
}
}
}
//
-->
</
script
></
head
>
<
body
>
<
form
>
<
select
name
=""
size
="1"
onchange
="Select(this.form,this);"
>
<
option
value
=" "
>
Select
</
option
>
<
option
value
="1"
>
Hide TB1
</
option
>
<
option
value
="1^3"
>
Hide TB1 & 3
</
option
>
<
option
value
="2^3^4"
>
Hide TB2,3,4
</
option
>
<
option
value
=""
>
Hide None
</
option
>
</
select
>
<
input
name
=""
size
="10"
value
="123"
>
<
input
name
=""
size
="10"
value
="234"
>
<
input
name
=""
size
="10"
value
="345"
>
<
input
name
=""
size
="10"
value
="456"
>
<
input
type
="radio"
name
="fred"
value
="1"
onclick
="Radio(this.form,this);"
>
<
input
type
="radio"
name
="fred"
value
="1^3"
onclick
="Radio(this.form,this);"
>
<
input
type
="radio"
name
="fred"
value
="2^3^4"
onclick
="Radio(this.form,this);"
>
<
input
type
="radio"
name
="fred"
value
=""
onclick
="Radio(this.form,this);"
><
br
>
</
form
>
</
body
>
</
html
>
<
select
name
="first"
id
="first"
onchange
="if(this.value == 'no') document.getElementById('sec').disabled=true; else document.getElementById('sec').disabled=false;"
>
<
option
value
="yes"
>
Yes
</
option
>
<
option
value
="no"
>
No
</
option
>
</
select
>
<
br
/><
br
/>
<
select
name
="sec"
id
="sec"
>
<
option
value
="yes"
>
Yes
</
option
>
<
option
value
="no"
>
No
</
option
>
</
select
>
查看全文
相关阅读:
axios express设置跨域允许传递cookie
yarn常用命令指北
Web代理工具NProxy
DevOps的了解
css图片hover放大
autoprefixer
谈谈浏览器http缓存
欢迎使用 MWeb
优化关键渲染路径CRP
chrome 61 更新
原文地址:https://www.cnblogs.com/simhare/p/877569.html
最新文章
Fiddle无法抓取网页信息或HTTPS
你的学习方法怎么样?IT的学习方法应该是什么-Dotest
实际场景:UI、原型与实际不符;研发怼你,你要怎么办?-Dotest软件测试
金字塔原理
dom4j的小例子
Xms Xmx PermSize MaxPermSize 区别
解决svn pritine text not exist问题
Java ClassLoader 原理详细分析(转)
转义字符的反转义
函数
热门文章
java初始化
(转)EasyUI-datagrid-自动合并单元格
javascript数组array
node升级后npm install不能安装新版本
vue hisory模式 配置nginx教程
数组巧去重new Set
如何利用 Swagger 消除前后端分离的障碍
vue webpack访问地址 localhost 改为ip 无法访问
一款不包含框架(例如:Vue、React、Angular 等)的 Webpack 启动器
git clone速度慢解决办法
Copyright © 2011-2022 走看看