求助,出错了!!!
不加条件之前
<script language="javascript">
function show()
{
var x=document.form1;
x.img.src=x.file.value;
x.ims.value=x.img.width+','+x.img.height;
}
</script>
<form action="" method="post" enctype="multipart/form-data" name="form1">
<input type="file" name="file">
<input type="button" name="Submit" value="°´Å¥" onClick="show()">
<img src="" id="img">
<input type="text" name="ims">
</form>
但是加了条件之后宽和高全成0了,
<script language="javascript">
function show()
{
var x=document.form1;
x.img.src=x.file.value;
if(x.img.width>164) {
x.img.width=164;
x.img.height=x.img.height/(x.img.width/164);
x.ims.value=x.img.width+','+x.img.height;}
else
{ x.img.width=x.img.width;
x.img.height=x.img.heigth;
x.ims.value=x.img.width+','+x.img.height;}
}
</script>
<form action="" method="post" enctype="multipart/form-data" name="form1">
<input type="file" name="file">
<input type="button" name="Submit" value="°´Å¥" onClick="show()">
<img src="" id="img">
<input type="text" name="ims">
</form>
大家帮我看看那个条件判断应该怎么写!!!!!!!