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" οnchange=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 οnclick='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">
只设定宽或高,就会自动调整了