JS 收缩 展开效果
2013-04-17 17:54
459 查看
<!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>
<title></title>
<style type="text/css">
.imgclass
{
width:200px;height:200px;
}
table tr td
{
width:300px;height:300px
}
</style>
<script src="jquery-1.9.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('#Button1').click(function () {
//获取的是所有类型(tagname)为img的元素
//$('img').hide(3000);
//$('img').show(3000);
//获取的是所有class属性的值为“imgclass”的元素
$('.imgclass').hide(3000);
$('.imgclass').show(3000);
})
})
</script>
</head>
<body>
<table>
<tr>
<td>
<img id="img1" src="images/1.jpg" class="imgclass" />
</td>
<td>
<img id="img2" src="images/2.jpg" class="imgclass" />
</td>
</tr>
<tr>
<td>
<img id="img3" src="images/3.jpg" class="imgclass" />
</td>
<td>
<img id="img4" src="images/4.jpg" class="imgclass" />
</td>
</tr>
</table>
<input id="Button1" type="button" value="玩儿" class="imgclass" /><br />
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
.imgclass
{
width:200px;height:200px;
}
table tr td
{
width:300px;height:300px
}
</style>
<script src="jquery-1.9.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('#Button1').click(function () {
//获取的是所有类型(tagname)为img的元素
//$('img').hide(3000);
//$('img').show(3000);
//获取的是所有class属性的值为“imgclass”的元素
$('.imgclass').hide(3000);
$('.imgclass').show(3000);
})
})
</script>
</head>
<body>
<table>
<tr>
<td>
<img id="img1" src="images/1.jpg" class="imgclass" />
</td>
<td>
<img id="img2" src="images/2.jpg" class="imgclass" />
</td>
</tr>
<tr>
<td>
<img id="img3" src="images/3.jpg" class="imgclass" />
</td>
<td>
<img id="img4" src="images/4.jpg" class="imgclass" />
</td>
</tr>
</table>
<input id="Button1" type="button" value="玩儿" class="imgclass" /><br />
</body>
</html>
相关文章推荐
- 在iframe里的页面编写js,实现在父窗口上创建动画效果展开和收缩的div(不变动iframe父窗口代码)
- 在iframe里的页面编写js,实现在父窗口上创建动画效果展开和收缩的div(不变动iframe父窗口代码)
- JS收缩展开效果
- js实现的侧边栏展开收缩效果
- JS+CSS实现DIV层的展开、收缩效果
- js如何实现目录树形展开收缩效果(2)
- js如何实现目录树形展开收缩效果(1)
- js 点击展开和收缩效果
- JS+CSS实现DIV层的展开、收缩效果
- 实用js+css多级树形展开效果导航菜单
- 一般左边后台点击收缩展开的效果
- 点击展开再点收缩文本的效果
- JS右下角广告窗口代码(可收缩、展开及关闭)
- 向下滑动展开/收缩JS广告
- 收缩与放大图片效果(JS+CSS)
- jquery简易收缩展开效果特效
- 3个收缩/展开/折叠的js代码
- 原生JS仿QQ阅读点击展开、收起效果
- js中如何点击自身,进行展开与收缩