javascript - 如何从本地文件夹中获取图像以显示在 div 元素 html 上?

标签 javascript css html

我在“C:/images/”上几乎没有 jpeg 图片。我想在网页上幻灯片放映这些图像。我正在使用 java 代码获取图像文件夹的正确路径,并使用 jsp 作为具有 html div 元素的前端来显示图像。我试过这样显示单张图片但失败了,谁能帮帮我

  <div id="image" style="background-color:yellow;  height:200px; width:100px;float:left;">
  <img src="C:/Desktop/Images/Image1.jpg" style="height:200px; width:100px;floatleft;">

最佳答案

这篇文章中的相同问题: Why can't I do <img src="C:/localfile.jpg">?

但您可以使用“../”来定位正确的路径。 http://www.pagetutor.com/html_tutor/missing.html

但是为什么你不想在你的应用程序上创建一个文件夹。它比在桌面等设备上访问它更容易。

关于javascript - 如何从本地文件夹中获取图像以显示在 div 元素 html 上?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19652602/

相关文章:

javascript - 无法让 jQuery UI 模态对话框成为模态

javascript - 使用预加载器延迟 css 动画?

java - 如何在JSP页面中突出显示 Activity 页面链接

html - 在另一个页面中偏移 anchor

html - 纯 CSS 滚动体和带有动态高度和宽度的静态 thead 表

javascript - 无法读取未定义的 ngResource 的属性 '$remove'

javascript - 如何将事件发送到 gulp-tap 的父流中

html 列,其宽度根据其内容自动改变

html - Bootstrap 3 : Emails defaulting to print media type even on screen

javascript - 尽管 API 已激活,但尝试使用嵌入 map API 时出现 ApiNotActivatedMapError