IMG的src的问题 服务器的和本地的

xuyue3000 2007-07-13 07:18:13
在本地直接大开只有这样的HTML 发现他是显示的出来的
可在用localhost的方式大开却发现他不显示了
<img src="file:///C|/Documents and Settings/All Users/Documents/My Pictures/示例图片/Sunset.jpg" width="100" />

我也试过 javascript 自动生成 ----------失败

也试过iframe 的src=file:///C|/Documents and Settings/All Users/Documents/My Pictures/示例图片/Sunset.jpg ----------失败

最后只能用
<div id="File_up1_showimg" style="background-repeat:no-repeat; background-image:url(file:///C|/Documents and Settings/All Users/Documents/My Pictures/示例图片/Sunset.jpg);">
可是他不能控制图片显示的大小........
...全文
817 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
「已注销」 2007-07-31
  • 打赏
  • 举报
回复
如果是文件css 他里面的路径应该是图片和css文件的相对路径 内嵌html的就是html的相对路径`~~
travelman 2007-07-29
  • 打赏
  • 举报
回复
这方法只能用在ie下呀
xuyue3000 2007-07-26
  • 打赏
  • 举报
回复
大家辛苦啦!!大家参考一下我发的
http://community.csdn.net/Expert/topic/5662/5662706.xml?temp=.2006342
我是从这里得到启示的!!
xuyue3000 2007-07-26
  • 打赏
  • 举报
回复
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript" type="text/javascript"><!--
function _(obj)
{
return document.getElementById(obj)
}
function changeimg(url){
//alert(url);
_("imgbox").filters[0].src=url;
}
//--></script>
<link rel="stylesheet" type="text/css" href="../style.css">
<style>
.box{
width:200px;
height:160px;
FILTER: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,src='C:/Documents and Settings/All Users/Documents/My Pictures/示例图片/Blue hills.jpg',sizingMethod='scale')
}
</style>
</head>

<body>
<br />
<br />
<br />

<table border="0" cellspacing="0" cellpadding="0">
<tr style="height:14px;">
<td style="width:14px;"><img src="img/l_t.jpg" alt="l_t" /></td>
<td style=" background-image:url(img/beiging.jpg); background-repeat:repeat-x;"></td>
<td style="width:14px;"><img src="img/r_t.jpg" alt="r_t" /></td>
</tr>
<tr>
<td style=" background-image:url(img/beiging.jpg); background-position:left; background-repeat:repeat-y;"> </td>
<td><div id="imgbox" class="box"></div></td>
<td style=" background-image:url(img/beiging.jpg); background-position:right; background-repeat:repeat-y;"> </td>
</tr>
<tr style="height:14px;">
<td><img src="img/l_b.jpg" alt="l_t" /></td>
<td style=" background-image:url(img/beiging.jpg); background-position:bottom; background-repeat:repeat-x;"></td>
<td><img src="img/r_b.jpg" alt="l_t" /></td>
</tr>
</table>
<input id="imgup" onchange="return changeimg(this.value);" type="file" />
</body>
</html>
找到方法啦!!!!!
travelman 2007-07-20
  • 打赏
  • 举报
回复
asdsad
xuyue3000 2007-07-15
  • 打赏
  • 举报
回复
实现图片上传预览功能 把图片上传上去还预览什么哦????
xuyue3000 2007-07-15
  • 打赏
  • 举报
回复
郁闷啊!!!!
xuyue3000 2007-07-13
  • 打赏
  • 举报
回复
我想实现这样的功能........
浏览客户端的图片让他显示出来
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
无标题页
</title></head>
<body style="margin:0px; padding:0px;">
<form name="form1" method="post" action="default.aspx" id="form1" enctype="multipart/form-data">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE2ODA3MTcwMzgPZBYCAgMPFgIeB2VuY3R5cGUFE211bHRpcGFydC9mb3JtLWRhdGFkZBi/B9wlFgmWXt9rE550MA14Zkeq" />
</div>

<script type="text/JavaScript">function File1_onchange(me) {
document.getElementById("showimg").innerHTML="";
document.getElementById("showimg").innerHTML="<img style=\"border-bottom-width:0px; width:200px; height:146px;\" src=\"file:///" + me + "\" alt=\"" + me + "\" />";
document.getElementById("showimg").style.backgroundImage="url(" + me +")";}</script>




<div align="center" style="display:inline; ;" ><table border="0" cellspacing="0" cellpadding="0" >
<tr style="height:14px;">
<td style="width:14px;"><img style="border-width:0px;" src="img/l_t.jpg" alt="l_t" /></td>
<td style=" background-image:url(img/beiging.jpg); background-repeat:repeat-x;"></td>
<td style="width:14px;"><img style="border-bottom-width:0px;" src="img/r_t.jpg" alt="r_t" /></td>
</tr>
<tr>
<td style=" background-image:url(img/beiging.jpg); background-position:left; background-repeat:repeat-y;"> </td>
<td><div id="File_up1_showimg" style="background-repeat:no-repeat; background-image:url(file:///C|/Documents and Settings/All Users/Documents/My Pictures/示例图片/Blue hills.jpg)"><img style="border-bottom-width:0px; width:200px; height:146px; " src="img/IMG_2121.JPG" alt="default" /></div></td>
<td style=" background-image:url(img/beiging.jpg); background-position:right; background-repeat:repeat-y;"> </td>
</tr>
<tr style="height:14px;">
<td><img style="border-bottom-width:0px;" src="img/l_b.jpg" alt="l_t" /></td>
<td style=" background-image:url(img/beiging.jpg); background-position:bottom; background-repeat:repeat-x;"></td>
<td><img style="border-bottom-width:0px;" src="img/r_b.jpg" alt="l_t" /></td>
</tr>
</table>
<input name="File_up1$File1" type="file" id="File_up1_File1" accept="image/*" onchange="File1_onchange(this.value)" /></div>
</form>

</body>
</html>
hookee 2007-07-13
  • 打赏
  • 举报
回复
为什么不把图片放到web目录呢?
xuyue3000 2007-07-13
  • 打赏
  • 举报
回复
我用的是ie7
c++信息学奥赛 2007-07-13
  • 打赏
  • 举报
回复
把图片放在和html文件相同的目录
<image src="Sunset.jpg">
  • 打赏
  • 举报
回复
background-image

不能改变大小

--------------
另外:本人感觉是路径问题,请用相对路径
travelman 2007-07-13
  • 打赏
  • 举报
回复
关注,原来就因为控制不了图片放弃了图片预览功能

61,112

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧