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
>
查看全文
相关阅读:
Qt C++中的关键字explicit——防止隐式转换(也就是Java里的装箱),必须写清楚
有栖川有栖《马来铁道之谜》读后感
Qt多国语言QT_TR_NOOP和QT_TRANSLATE_NOOP
Qt调用VC++生成的动态链接库
QTabWidget添加自定义样式
Qt跨线程信号和槽的连接(默认方式是直连和队列的折中)
OO五大原则
《Head First Python》学习笔记03 异常处理
使用Qt实现MDI风格的主窗体
Qt中文乱码问题(比较清楚,同一个二进制串被解释成不同的语言)
原文地址:https://www.cnblogs.com/simhare/p/877569.html
最新文章
delphi.memory.分配及释放---New/Dispose, GetMem/FreeMem及其它函数的区别与相同
终于明白了那三个函数调用的时候为什么错误——回调函数里有除零现象存在!
疯狂delphi
LearnCpp.com
使用QtScript库解析Json数组例子
QDialog 模态对话框与事件循环(exec其实就是调用了show和eventLoop.exec)
QEventLoop 的使用两例
如何让 Qt 的程序使用 Sleep(主线程没有Sleep函数,但线程可用自带的保护函数Sleep)
Qt源码分析之信号和槽机制
UVa-Where's Waldorf?
热门文章
将某个Qt4项目升级到Qt5遇到的问题(13条方法)
Qt使用MinGW编译,如何忽略警告
C++11 in Qt5
Qt自定义sleep延时函数(巧妙的使用时间差,但这样似乎CPU满格,而不是沉睡)
Windows7下移植Qt4.8.4项目到QT5.2上时遇到的一些问题(包括三篇参考文章)
openlayers 加载瓦片详解 一
Qt下使用的静态链接库------ *.lib转化为mingw使用的.a格式的静态库
qmake和moc的功能(★firecat推荐★)
组态软件厂家一览
关于栈和堆的定量分析(★firecat推荐★)
Copyright © 2011-2022 走看看