跪求大神,挑战大神的问题。为什么JS显示图片的缩略图在.HTML中能运行,在.ASPX中不能?(我现在是菜鸟)
跪求大神。为什么JS显示图片的缩略图在.HTML中能运行,在.ASPX中不能?(我现在是菜鸟)我直接复制代码过去,JS是能用的,但是显示不了图片。
<script language="javascript" type="text/javascript">
var flag=false;
function DrawImage(ImgD){
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= 120/80){
if(image.width>120){
ImgD.width=120;
ImgD.height=(image.height*120)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt=image.width+"×"+image.height;
}
else{
if(image.height>80){
ImgD.height=80;
ImgD.width=(image.width*80)/image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt=image.width+"×"+image.height;
}
}
/**//*else{
ImgD.src="";
ImgD.alt=""
}*/
}
function FileChange(Value)
{
flag=false;
document.all.uploadimage.width=10;
document.all.uploadimage.height=10;
document.all.uploadimage.alt="";
document.all.uploadimage.src=Value;
}
function BeforeUpLoad(){
if(flag) alert("OK");else alert("FAIL");
}
</script>
<INPUT style="WIDTH: 143px; HEIGHT: 18px" type=file size=8 name=pic onchange="javascript:FileChange(this.value);">
<IMG id=uploadimage height=10 width=10 src="" onload="javascript:DrawImage(this);" ><BR>
<Button onclick="javascript:BeforeUpLoad();">提交</Button>
--------------------编程问答-------------------- 可以用vs调试js脚本,设置断点,看看是否进入相应的函数, --------------------编程问答-------------------- 你先在DrawImage直接给image.src赋给一个图片路径,看看能显示不
--------------------编程问答-------------------- <img id="img" style="visibility:hidden" src="fileuploadimg/pic00/0518770339041.gif" height="100px" width="100px" >是不显示的。
<img id="img" src="fileuploadimg/pic00/0518770339041.gif" height="100px" width="100px" >这样是可以显示的。大神们,到底style="visibility:hidden"是什么属性? --------------------编程问答-------------------- 去掉onload="javascript:DrawImage(this);" ,,直接加路径是能显示的!!大神们,,该怎么样解决呢!!其他大神们可以复制代码到自己的电脑试下 --------------------编程问答-------------------- visibility 属性规定元素是否可见。
style="visibility:hidden"是隐藏的意思 --------------------编程问答-------------------- 大神们,能不能帮我搞好上面那个问题?大神们可以复制代码到自己的电脑试下!!跪救了 --------------------编程问答-------------------- style="visibility:hidden"顾名思义是隐藏的意思,如果加上这句样式,那么这个标签内的内容将不显示
补充:.NET技术 , C#