JS----图片显示出来后放大缩小
2016-05-31 12:45
411 查看
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script>
window.onload=function()
{
/*var divpostion = document.getElementById("bu1");
divpostion.style.position="absolute";
divpostion.style.top=700;
divpostion.style.left=700;*/
}
function show()
{
var divdo = document.getElementById("a");
divdo.innerHTML="<img src='xx.jpg' id='im'>"
var dis =document.getElementById("im");
dis.height=300;
dis.width=300;
}
function big()
{
var di =document.getElementById("im");
di.height= di.height+100;
di.width=di.height+100;
}
function ss()
{
var di =document.getElementById("im");
di.height= di.height-100;
di.width=di.height-100;
}
</script>
</head>
<body>
<div id="a">xxxx</div>
<form>
<input type="button"onclick="show()">
<input type="button" value="放大"onclick="big();" id="bu1" style="position: absolute;top: 600px;left: 500px" >
<input type="button" value="缩小"onclick="ss();" id="bu2"style="position: absolute;top: 600px;left: 700px" >
<input>
</form>
</body>
</html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script>
window.onload=function()
{
/*var divpostion = document.getElementById("bu1");
divpostion.style.position="absolute";
divpostion.style.top=700;
divpostion.style.left=700;*/
}
function show()
{
var divdo = document.getElementById("a");
divdo.innerHTML="<img src='xx.jpg' id='im'>"
var dis =document.getElementById("im");
dis.height=300;
dis.width=300;
}
function big()
{
var di =document.getElementById("im");
di.height= di.height+100;
di.width=di.height+100;
}
function ss()
{
var di =document.getElementById("im");
di.height= di.height-100;
di.width=di.height-100;
}
</script>
</head>
<body>
<div id="a">xxxx</div>
<form>
<input type="button"onclick="show()">
<input type="button" value="放大"onclick="big();" id="bu1" style="position: absolute;top: 600px;left: 500px" >
<input type="button" value="缩小"onclick="ss();" id="bu2"style="position: absolute;top: 600px;left: 700px" >
<input>
</form>
</body>
</html>
相关文章推荐
- JS函数
- JS--时间器控制图片显示
- JS 页面时间的停止与开始
- JS学习第一课
- Javascript权威指南
- JS设计模式之装饰者模式
- JS -- =、==和===
- JS函数声明和函数表达式的区别
- jsGantt(甘特图控件) - Copyにんじゃ - 博客频道 - CSDN.NET
- FREE javascript gantt - JSGantt HTML and CSS only
- JSON-LD
- JavaScript UI Library, Ajax Components & HTML5 Framework - DHTMLX
- JS设计模式之外观模式
- 全面理解面向对象的 JavaScript
- asp.net中前台JavaScript库调用后台C#变量和有参函数方法
- js 原型和构造方法 转载
- js获取小数点后两位
- Jsonp解决ajax跨域问题
- JS定时器使用,定时定点,固定时刻,循环执行详解
- 浅谈js中的延迟执行和定时执行