当前位置:开发者网络 >> 网页特效 >> 图形图象 >> 内容
精彩推荐
分类最新特效
分类热点特效
  
自由设定图片大小
日期:2004-06-26   人气:   【字体: 】【收藏此文


<!-- 网页特效代码由[中国WEB开发者网络:http://www.ChinaWebDev.com]提供! -->
<!-- 要实现此效果需要 2 个步骤: -->

<!-- 第 1 步: -->
<!-- 把下面的代码加到<HEAD></HEAD>区域中: -->

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function ViewImage(form) {
ix = form.width.value;
iy = form.height.value;
ifile = form.url.value;

var win;
win = window.open("","","width="+ix+",height="+iy+",menubar=no,toolbar=no,top=100,left=100");

win.document.open();
win.document.write("<html><head></head><body>");
win.document.write('<div style="position:absolute;width:'+ix+'px;height:'+iy+'px;left:0px;top:0px">');
win.document.write("<img src="+ifile+" width=" + ix + " height=" + iy + "></div></body></html>");
win.document.close();
}
// End -->
</script>




<!-- 第 2 步: -->
<!-- 把下面的代码加到<BODY></BODY>区域中: -->

<form name=imageform>
<input name=url type=file size=40>
<p>
Height: <input name=height type=text value="200" size=3>
Width: <input name=width type=text value="150" size=3>
<p>
<input type=button value="View Image" onClick="ViewImage(this.form);">
</form>