2012-08-10 31 views
-2

我目前正在建設一個網站,用於數字菜單顯示。我無法獲取輸入字段,提示用戶更改頁面中的圖片。圖像將不會通過網站服務器在本地顯示在上網本上(圖片選擇會定期更改)。任何想法將是一個很大的幫助 波紋管是我的代碼至今:JavaScript來插入圖像

<!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> 
+0

目前還不清楚你的問題是什麼。請說明您想要達到的預期結果以及您想要幫助的具體問題。 – jfriend00 2012-08-10 21:23:33

回答

1

它似乎並不像你的問題是清楚的。要替換圖像的來源,它是如此簡單:

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

[編輯:]基於使用文件的最後的評論://,看起來這是你所追求的:

<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='' /> 
+0

抱歉,不清楚。我需要的是當點擊「徽標」字段時,它會提示用戶從本地計算機導入圖片並將其發佈到該字段。 – user1591322 2012-08-10 21:29:52

+0

因此,流程是:用戶點擊徽標>上傳表單彈出>用戶將圖像上傳到iframe之類的東西,在後臺上傳並在完成時提示主窗口>主頁面更新爲上傳的圖像。那是你的目標? – 2012-08-10 21:35:10

+0

這就是它正好 – user1591322 2012-08-10 21:43:51