网页中改变图片大小
2007-07-15 15:18
465 查看
<script language="JavaScript" type="text/JavaScript">
//改变图片大小
function resizepic()
{
Pic=document.body.getElementsByTagName("img");
for(i=0;i<Pic.length;i++)
{
if(Pic[i].width>500)
{
Pic[i].height=Pic[i].height*500/Pic[i].width;
Pic[i].width=500;
}
}
}
</script>
</head>
<body onload=javascript:resizepic()>
另外:
1
<script language="JavaScript" type="text/JavaScript">
2
//改变图片大小
3
function resizepic(thispic)
4
{
5
if(thispic.width>700)
{thispic.height=thispic.height*700/thispic.width;thispic.width=700;}
6
}
7
//无级缩放图片大小
8
function bbimg(o)
9
{
10
var zoom=parseInt(o.style.zoom, 10)||100;
11
zoom+=event.wheelDelta/12;
12
if (zoom>0) o.style.zoom=zoom+'%';
13
return false;
14
}
15
//双击鼠标滚动屏幕的代码
16
var currentpos,timer;
17
function initialize()
18
{
19
timer=setInterval ("scrollwindow ()",30);
20
}
21
function sc()
22
{
23
clearInterval(timer);
24
}
25
function scrollwindow()
26
{
27
currentpos=document.body.scrollTop;
28
window.scroll(0,++currentpos);
29
if (currentpos !=document.body.scrollTop)
30
sc();
31
}
32
document.onmousedown=sc
33
document.ondblclick=initialize
34
35
//更改字体大小
36
var status0='';
37
var curfontsize=10;
38
var curlineheight=18;
39
function fontZoomA()
{
40
if(curfontsize>8)
{
41
document.getElementById('fontzoom').style.fontSize=(--curfontsize)+'pt';
42
document.getElementById('fontzoom').style.lineHeight=(--curlineheight)+'pt';
43
}
44
}
45
function fontZoomB()
{
46
if(curfontsize<64)
{
47
document.getElementById('fontzoom').style.fontSize=(++curfontsize)+'pt';
48
document.getElementById('fontzoom').style.lineHeight=(++curlineheight)+'pt';
49
}
50
}
51
</script>
相关文章推荐
- 在网页中动态改变图片大小
- 如何使用表单结合javascript改变网页图片的大小
- jQuery动态改变图片显示大小(修改版)的实现思路及代码
- 滚轮改变图片大小
- 使用php_imagick对图片改变大小、旋转、锐化、减色或是增加特效
- 批量改变图片大小
- 限制网页图片大小JS函数
- 上传图片并改变图片大小
- Java改变图片的大小
- 代码改变按钮,图片等大小
- 背景图片随窗口大小改变自适应
- js 图片区域可点击,适配移动端,图片大小随意改变
- flex中可改变大小地播放gif图片
- JavaScript 动态改变图片大小
- android中的CheckBox改变背景图片后图片显示大小不正确的问题
- Java Jsoup抓取符合指定大小的网页的图片,并保存在本地磁盘
- android之ImageButton实现选中改变背景,附加(图片自动适配组件大小)
- 关于fckeditor ie7 不能拖拽改变图片大小的解决办法
- 图片编辑 – 保存、裁剪、改变大小、旋转
- winform在上传图片时改变图片大小