-2

我目前正在构建一个用于数字菜单显示的站点。我在获取提示用户更改页面中图片的输入字段时遇到问题。图像将在本地显示上网本上托管,而不是通过站点服务器(图片选择将定期更改)。任何想法都会有很大的帮助,下面是我到目前为止的代码:

 <!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=utf-8" />
<title>Custom Entree</title>
<style type="text/css">
body {
    overflow:hidden;
    }
#apIMG {
    position:absolute;

    top:50px;
    width:1080px;
    height:200px;
    z-index:2;
    text-align:right;
}

#apPDF {
    position:absolute;
    top:350px;
    width:100%;
    height:50%;
    z-index:1;
    text-align:center;
}
#pdfscoop {
    height:1358px;
    width:1050px;

}


#PRC {
    position:absolute;
    height:120px;
    width:100%;
    top:1708px;
    font-family:BrushScriptStd;
    text-align:center;
    }

#price {
    height:120px;
    width:1080px;
    text-align:center;
    font-family:BrushScriptStd;
    font-size:110px;
    color:#090;

    }

</style>

<script type="text/javascript">
var img = document.getElementById('logo').src='';
document.images.item(
</script>


</head>

<body>

<div id="apIMG"><a href="http://www.artisancateringandevents.com/Content_Pages/scoop_webMenu.html" target="_top"><img src="scoopTitle.png" height="130%" width="*" ></image></a></div>

<div id="apPDF">

<embed name="" id="logo" src="custom.pdf#scrollbar=0" type="application/pdf" width="900px" height="900px" scrollbar="0" /><input name="" type="image" width="900" height="900" /></div>
<div id="PRC"><input type="text" id="price" border="0" /><br/>
<input type="text" id="price" border="0" /></div>
</body>

</html>
4

1 回答 1

1

看来你的问题不是很清楚。要替换图像的源,很简单:

var images = ['imageone.jpg','imagetwo.jpg'];    
var img    = document.getElementById('logo');
img.src    = images[0];

[编辑:]根据您使用 file:// 的最后评论,看起来这就是您所追求的:

<script type='text/javascript'>
    function callme() {
        document.getElementById('logo').src = document.getElementById('file').value;
    }
</script>
<img id='logo' src='' />
<input id='file' type='file' onchange='callme()' value='' />
于 2012-08-10T21:24:00.470 回答