zoukankan
html css js c++ java
JS实现的展开隐藏效果
利用JS实现展开隐藏效果:
Code
1
<
html
>
2
<
head
>
3
<
title
>
JS实现展开隐藏
</
title
>
4
<
script language
=
"
JavaScript
"
type
=
"
text/JavaScript
"
>
5
function showhidediv(id)
{
6
try
{
7
8
var id1
=
document.getElementById(id);
9
id3.value
=
"
收缩
"
;
10
if
(id1)
11
{
12
if
(id2.style.display
==
'
block
'
)
13
{
14
id2.style.display
=
'
none
'
;
15
id3.value
=
"
展开
"
;
16
}
17
else
18
{
19
id2.style.display
=
'
block
'
;
20
}
21
}
22
}
23
catch
(e)
{}
24
}
25
</
script
>
26
<
body
>
27
<
div id
=
"
id1
"
>
28
<!--
29
<
div onclick
=
'
showhidediv("id1");
'
style
=
"
color:red;
"
>
点击标题
</
div
>-->
30
<
input type
=
"
button
"
value
=
"
展开
"
onclick
=
'
showhidediv("id1");
'
id
=
"
id3
"
style
=
"
background-color:white;
"
>
31
<
div id
=
"
id2
"
style
=
"
display:none;
"
>
32
id2层的内容
<
br
>
id2层的内容
<
br
>
id2层的内容
<
br
>
id2层的内容
<
br
>
id2层的内容
<
br
>
33
id2层的内容
<
br
>
id2层的内容
<
br
>
id2层的内容
<
br
>
id2层的内容
<
br
>
id2层的内容
<
br
>
34
</
div
>
35
</
body
>
36
</
head
>
37
</
html
>
38
查看全文
相关阅读:
Linux基础命令—umask
dd(处理文件)
HDU6446 Tree and Permutation(树、推公式)
UVA5913 Dictionary Sizes(字典树)(转载)
Luogu P1330 封锁阳光大学 (黑白染色)
codeforces 1025B Weakened Common Divisor(质因数分解)
UVA1623 Enter The Dragon (贪心)
HDU6395 Sequence(矩阵快速幂+数论分块)
BZOJ1257 [CQOI2007]余数之和 (数论分块)
Codeforces 1011C Fly(二分+模拟)
原文地址:https://www.cnblogs.com/guanjie20/p/1410415.html
最新文章
2018/3/4 省选模拟赛 160分
2018/3/1 省选模拟考试 50分
2018/2/28 省选模拟赛 40分
Python自动化之form验证
python自动化之models 进阶操作二
python自动化之model进阶操作一
python自动化之djangoform表单验证
Python自动化之django model验证(很弱,感觉应用场景不多)
Python中为什么要使用self?
Python自动化之Django中间件
热门文章
Python自动化之Django的CSRF
Python自动化之5种session类型
Python自动化之session
python光速搭建Linux下载服务器
centos下用docker安装kali
/etc/shadow
配置与管理samba服务器
编译安装 Nginx
/etc/passwd
shell编程基础
Copyright © 2011-2022 走看看