| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1221 人关注过本帖
标题:图片问题【求助]】
只看楼主 加入收藏
islet
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:89
帖 子:6548
专家分:0
注 册:2005-1-28
收藏
得分:0 

[CODE]脚本说明: 第一步:把如下代码加入<body>区域中 <style> .divstyle{position:absolute; width="0";height:"0"} </style>

<SCRIPT LANGUAGE="JavaScript"> <!-- Begin 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("No Image found!");} else {if (index == -3){alert("Unknow image type"); 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;} // End --> </script> <center> <form name="image"> <input type="file" name="image_file"><br> <input type="button" name="show" value="显示图片" onclick="showimg(this.form)"> <br> 宽度 高度 <br><img src="up0821.gif" onmousedown="over_upw()" onmouseup="clt()"> <img src="down0821.gif" onmousedown="over_downw()" onmouseup="clt()"> <input type="text" name="width" size="4" readonly> <input type="text" name="height" size="4" readonly> <img src="up0821.gif" onmousedown="over_uph()" onmouseup="clt()" > <img src="down0821.gif" onmousedown="over_downh()" onmouseup="clt()"> <br><br> <table border ="1"> <tr><td> <img src="053.gif" name="changing"> </td></tr></table> </form> <div STYLE="left:-5000 px;top:0" class="divstyle"> <P ><img src="http://makedream.diy.myrice.com/picture/053.gif" name="changing2"></p> </div> </center>

第二步:把<body>中的内容改为: <body bgcolor="#fef4d9" onLoad="set()"> [/CODE]

[此贴子已经被作者于2005-9-3 10:56:19编辑过]

2005-09-03 10:47
islet
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:89
帖 子:6548
专家分:0
注 册:2005-1-28
收藏
得分:0 

[CODE]<style> .divstyle{position:absolute; width="0";height:"0"} </style>

<SCRIPT LANGUAGE="JavaScript"> <!-- Begin 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("No Image found!");} else {if (index == -3){alert("Unknow image type"); 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 fāast_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;} // End --> </script>

<body bgcolor="#fef4d9" onLoad="set()"> <center> <form name="image"> <input type="file" name="image_file"><br> <input type="button" name="show" value="显示图片" onclick="showimg(this.form)"> <br> 宽度 高度 <br><img src="http://makedream.diy.myrice.com/picture/up0821.gif" onmousedown="over_upw()" onmouseup="clt()"> <img src="http://makedream.diy.myrice.com/picture/down0821.gif" onmousedown="over_downw()" onmouseup="clt()"> <input type="text" name="width" size="4" readonly> <input type="text" name="height" size="4" readonly> <img src="http://makedream.diy.myrice.com/picture/up0821.gif" onmousedown="over_uph()" onmouseup="clt()" > <img src="http://makedream.diy.myrice.com/picture/down0821.gif" onmousedown="over_downh()" onmouseup="clt()"> <br><br> <table border ="1"> <tr><td> <img src="http://makedream.diy.myrice.com/picture/053.gif" name="changing"> </td></tr></table> </form> <div STYLE="left:-5000 px;top:0" class="divstyle"> <P ><img src="053.gif" name="changing2"></p> </div> </center>[/CODE]

2005-09-03 10:56
islet
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:89
帖 子:6548
专家分:0
注 册:2005-1-28
收藏
得分:0 
[CODE]
&lt;script language="JavaScript"&gt;
&lt;!--
function cc(str){
 pic1.width=str+10;
}
--&gt;
&lt;/script&gt;
&lt;img src="http://www. name="pic1" width="100" id="pic1" onClick="cc(this.width)"&gt;&lt;br&gt;
&lt;button onClick="pic1.width=100"&gt;还原&lt;/button&gt;
[/CODE]
2005-09-07 08:45
快速回复:图片问题【求助]】
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022622 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved