當前位置:開發者網絡 >> 網頁特效 >> 圖形圖像 >> 內容
精彩推薦
分類最新特效
分類熱點特效
   
自由設定圖片大小
日期: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>