收藏 不显示删除回复显示所有回复显示星级回复显示得分回复 急!!!在线等!!为什么给img标签的src赋值,IE可以显示图片,但火狐显示不了呢
代码如下,我想将file标签浏览的地址放到img下的src上,IE可以显示图片,但火狐不能这是怎么回事?急!!!在线等
</script>
<script type="text/javascript">
$("#supPhoto").change(function(){
// alert($("#supPhoto").val());
document.getElementById("bigImage").src =$("#supPhoto").val();
}) ;
</script>
</head>
<body>
<div id=imgContainer class=imgContainer><img id=bigImage src="${photoPath}" /> </div>
<tr>
<td height="40">
<s:file name="supPhoto" id="supPhoto" class="gensched-37" ></s:file>
<input type="hidden" name="proId" value="${proId}">
<input type="hidden" name="proPath" value="${proPath}">
</td>
<td>
</td>
</tr>
</body>
</html> --------------------编程问答-------------------- 这是兼容问题。。。 --------------------编程问答-------------------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> 图片加载完毕后自动轮换 </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="YangHui">
<META NAME="Keywords" CONTENT="YangHui">
<META NAME="Description" CONTENT="YangHui">
</HEAD>
<BODY>
<IMG name="animation" SRC="images/0.gif" WIDTH="180" HEIGHT="200" BORDER="0" ALT="晶莹">
<SCRIPT LANGUAGE="JavaScript">
<!--
var frame = 0;
var timeout_id = null;
function animate(){
document.animation.src = aniframes[frame].src;
if (frame == 3)
{
frame = 0;
} else{
frame = (frame + 1) % 10;
}
timeout_id = setTimeout("animate()", 500);
}
var aniframes = new Array(4);
var num_loaded_images = 0;
function countImages(){
if (++num_loaded_images == aniframes.length)
{
animate();
}
}
for (var i = 0; i < 4; i++)
{
aniframes[i] = new Image();
aniframes[i].onload = countImages;
aniframes[i].src = "images/" + i + ".gif";
}
//-->
</SCRIPT>
</BODY>
</HTML> --------------------编程问答-------------------- //图片预览代码,供参考
var imgPath; //图片路径
var Browser_Agent = navigator.userAgent;
var Preview = document.getElementById(divImage);
Preview.innerHTML = "";
if (Browser_Agent.indexOf("Firefox") != -1)//判断浏览器的类型
{
//火狐浏览器
imgPath = upload.files[0].getAsDataURL();
Preview.innerHTML = "<img id='imgPreview' src='" + imgPath
+ "' width='" + width + "' height='" + height + "'/>";
} --------------------编程问答-------------------- 我试了,好像不管用呀 --------------------编程问答-------------------- 我的FF6.0.2 没问题 --------------------编程问答-------------------- 我的版本低,把你这段放到我的页面上了,但不好使,能让我看看你完整的代码吗,十分感谢 --------------------编程问答-------------------- //====================================================================================================
// [名 称] 图片预览
//----------------------------------------------------------------------------------------------------
// [描 述] 上传图预览,显示预览图片的Div和图片大小可以自己设置
//----------------------------------------------------------------------------------------------------
// [参数说明]
// divImage 显示预览图片的Div
// upload 上传控件
// width 图片宽度
// height 图片高度
//----------------------------------------------------------------------------------------------------
// [使用示例]
// <div id="Preview" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);"></div>
// <input name="uploadIamge" type="file" onchange="PreviewImage('Preview',this,20,20);" />
//====================================================================================================
function PreviewImage(divImage, upload, width, height) {
if(upload.value==""){
return false;
}
var isImage = /\.jpg|\.jpeg|\.gif|\.png|\.bmp$/i;
if (!isImage.test(upload.value)) {
alert("图片格式错误,请重新选择!");
return false;
}
var imgPath; //图片路径
var Browser_Agent = navigator.userAgent;
var Preview = document.getElementById(divImage);
Preview.innerHTML = "";
if (Browser_Agent.indexOf("Firefox") != -1)//判断浏览器的类型
{
//火狐浏览器
imgPath = upload.files[0].getAsDataURL();
Preview.innerHTML = "<img id='imgPreview' src='" + imgPath
+ "' width='" + width + "' height='" + height + "'/>";
} else {
if (navigator.userAgent.indexOf("MSIE 6.0") == -1
&& navigator.userAgent.indexOf("MSIE") > -1) {
upload.select();
var imgSrc = document.selection.createRange().text;
//IE7、8预览方式
Preview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgSrc;
Preview.style.width = width;
Preview.style.height = height;
} else {
// IE6预览方式
Preview.innerHTML = "<img id='image_view_" + "' src='"
+ upload.value + "' style='width:" + width + "px;height:"
+ height + "px;' />";
}
}
} --------------------编程问答-------------------- <div id="Preview" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);"></div>
<input name="imageFile" id="imageFile" type="file" onchange="PreviewImage('Preview',this,400,240);" />
补充:Java , Web 开发