中国网站美工网!网页设计者的天堂!
本站特色:HTML网页模版下载    
  您的位置:

首页 >> 网页特效 >> 相关特效 >> 正文

相关信息

右键打开收藏夹
下拉的广告条
一个非常令人生气的脚本强行设为
链接弹出警告框
点击加入收藏夹
JScript实现的IP地址输入框
随次数变化提示
弹出窗口自动关闭
离开页面弹出窗口
进入时显示信息
链接确认按钮
记录页面更新时间
页面载入等待
打开硬盘驱动器 (直接从网上打开
集成Cookies
关闭网页窗口启动收藏夹
输入框测试警告
Netscape 6存在JavaScript设计缺
在网页完全载入前会出现图片(文字
比较COOL的滤镜效果 

自由控制显示图片大小

自由控制显示图片大小


来源: 不详 | 时间: 2005-12-14 20:05:06 | 人气:

 

自由控制显示图片大小

要完成此效果需要两个步骤

第一步:把如下代码加入到<head>区域中

<style>
 .divstyle{position:absolute; width="0";height:"0"}
</style>
<script>
<!--
function showimg(form)
{
adres = form.image_file.value;
index = adres.indexOf(".gif");
index = index + adres.indexOf(".jpg");
index = index + adres.indexOf(".bmp");
if (form.image_file.value == "")
  {alert("错误,未发现任何图片!");}
else
  {if (index == -3){alert("错误的图片格式");
    form.width.value=0;
    form.height.value=0;}
  else
    {
    var img_obj = new Image();
    img_obj = form.image_file.value;
    document.changing.src = img_obj;
    document.changing2.src= img_obj;
    document.changing.width = document.changing2.width;
    document.changing.height = document.changing2.height;
    set();
}
  }
}
fast = 0;
change = 0;
function upw(){
  document.image.width.value=parseInt(document.image.width.value)+1;
  resize();}
function over_upw(){upw();
  change = 1;
  changetime = setTimeout("fast_upw()","600");}
function fast_upw(){clearTimeout(changetime);
  upw();
  fast = setTimeout("fast_upw()","100");}
function clt(){
if (change == 1){clearTimeout(changetime);}
clearTimeout(fast);
change = 0;
}
function resize()  {document.changing.height = document.image.height.value;
  document.changing.width = document.image.width.value;}
function downw(){document.image.width.value=parseInt(document.image.width.value)-1;
  resize();}
function over_downw(){downw();
  change = 1;
  changetime = setTimeout("fast_downw()","600");}
function fast_downw(){clearTimeout(changetime);
  downw();
  fast = setTimeout("fast_downw()","100");}
function uph(){document.image.height.value=parseInt(document.image.height.value)+1;
 resize();}
function over_downh(){downh();
  change = 1;
  changetime = setTimeout("fast_downh()","600");}
function fast_downh(){clearTimeout(changetime);
  downh();
  fast = setTimeout("fast_downh()","100");}
function over_uph(){uph();
  change = 1;
  changetime = setTimeout("fast_uph()","600");}
function fast_uph(){clearTimeout(changetime);
  uph();
  fast = setTimeout("fast_uph()","100");}
function downh(){document.image.height.value=parseInt(document.image.height.value)-1;
  resize();}
function set(){
  document.image.width.value=document.changing.width;
  document.image.height.value=document.changing.height;}
-->
</script>


第二步:把如下代码加入到<body>区域中

<center>
<form name="image">
<input type="file" name="image_file"><br><br>
<input type="button" name="show" value="Show image" onclick="showimg(this.form)">
<br><br>
宽   高
<br><img src="../ts/pic/up.gif" onmousedown="over_upw()" onmouseup="clt()">
<img src="../ts/pic/down.gif" onmousedown="over_downw()" onmouseup="clt()">

本新闻共2页,当前在第1页  1  2  

 
  上一篇:图像循环明暗变化  下一篇:比较COOL的滤镜效果
Copyright © 2005 - 2006 WEB600.Net,All Rights Reserved
业务联系 QQ 站长:106324307 美工:270348300 程序:63888546
E-mail: 3235183@163.com MSN: fuqiyangru@hotmail.com
中国网站美工网--网页设计者的天堂! 陕ICP备06005517号
本站资源来自互联网 如果侵犯您的权利 请通知我们 我们会尽快删除