1:
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function showimg()
{
document.Myform.Myimg.src=document.Myform.filename.value;
}
//-->
</SCRIPT>
<BODY>
<FORM name=Myform METHOD=POST ACTION="">
<INPUT name=filename TYPE="file" onchange=setTimeout('showimg()',500)>
<IMG name=Myimg SRC="" BORDER="0">
</FORM>
</BODY>
</HTML>
2:
就這樣,可以了,如果想限制下大小,就在
function showimg()
{
document.Myform.Myimg.src=document.Myform.filename.value;
document.Myform.Myimg.width=;
document.Myform.Myimg.height=;
}
3:
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<IMG id=a SRC="" WIDTH="400" HEIGHT="300" BORDER="0" ALT=""><input type=file id=b><button onclick='aa()'>瀏覽</button>
</BODY>
</HTML>
<SCRIPT LANGUAGE="JavaScript">
<!--
function aa(){
document.getElementById("a").src=document.getElementById("b").value;
}
//-->
</SCRIPT>
4:
<IMG ……width="80">
或者
<IMG ……height="80">
只設定寬或高,就會自動調整了