html中文件路径怎么写
1.HTML相对路径怎么写
HTML写相对路径的代码:
<html>
<body>
<center>
小说
<p><a href="/jinyong/sd.html">;《射雕英雄传》</a>
<a href="/gulong/scj.html">;《长生剑》</a></p>
</p></body>
</html>
相对index.html所有的目录而言:
“../”表示上一级目录开始
“./”表示当前同级目录开始
“/”表示根目录开始。
扩展资料
建一个源文件info.html,在info.html里要引用index.html文件作为超链接。
表示源文件所在目录的上一级目录,
假设info.html路径是:c:\Inetpub\ww wroot\sites\blabla\info.htm l
假设index.html路径是:c:\Inetpub\pub\的MVC路由模式。视图/控制器。。。。当然这个就简单说一下。
3.html5中对文件路径的操作是绝对路径还是相对路径
不管是HTML还是HTML5都是有2种路径写法:相对路径和绝对路径:
1. HTML相对路径(Relative Path)
用途:指定由这个文件所在的路径引起的跟其它文件(或文件夹)的路径关系
如果源文件和引用文件在同一个目录里,直接写引用文件名即可,这时引用文件的方式就是使用相对路径。
下面建立两个HTML文档info.html和index.html,用作示例,要求都是在info.html加入index.html超链接。
eg1:相对路径的简单应用
假设:info.html路径是:c:/Inetpub/pub/pub/pub/pub/pub/pub/pub/pub/pub/pub/pub/pub/pub/pub/pub/pub/pub/pub/pub/wwwroot/sites/blabla/html/tutorials/index.html 在info.html加入index.html超链接的代码应该这样写:这是超连接 HTML绝对路径:在我们平时使用计算机时要找到需要的文件就必须知道文件的位置,而表示文件的位置的方式就是路径,例如只要看到这个路径:c:/website /img/photo.jpg我们就知道photo.jpg文件是在c盘的website目录下的img子目录中。类似于这样完整的描述文件位置的路径就是绝对路径。
我们不需要知道其他任何信息就可以根据绝对路径判断出文件的位置。而在网站中类似以,这个文件的绝对路径就是。
html本地路径怎么写
1.HTML相对路径怎么写
HTML写相对路径的代码:
<html>
<body>
<center>
小说
<p><a href="/jinyong/sd.html">;《射雕英雄传》</a>
<a href="/gulong/scj.html">;《长生剑》</a></p>
</p></body>
</html>
相对index.html所有的目录而言:
“../”表示上一级目录开始
“./”表示当前同级目录开始
“/”表示根目录开始。
扩展资料
建一个源文件info.html,在info.html里要引用index.html文件作为超链接。
表示源文件所在目录的上一级目录,
假设info.html路径是:c:\Inetpub\ww wroot\sites\blabla\info.htm l
假设index.html路径是:c:\Inetpub\pub\的MVC路由模式。视图/控制器。。。。当然这个就简单说一下。
6.本地的html怎么直接通过路径就读取本地文件
要引入图片就<img class="setImg" src="a.jpg" alt=""> src里是你想引入的本地图片的相对路径,也就是相对于你这个html文件,它在什么位置,如果在同一个文件夹下,就像我这样直接引就可以了,如果在上一级目录,就“../a.jpg”再上一级就再加个"../"。
引入css和js文件类似,只不过标签不一样,引css用
<link rel="stylesheet" href="">
js,用<script>;标签
src下的文件路径怎么写
1.html中img的src相对路径怎么写
html中img的src相对路径的写法:同一个目录的文件引用---直接写引用文件名即可。
如果源文件和引用文件在同一个目录里,直接写引用文件名即可,这时引用文件的方式就是使用相对路径。例如:我们现在建一个源文件info.html,在info.html里要引用index.html文件作为超链接。
假设info.html路径是:c:/Inetpub//jebel/helper/this.getClass().getResource(".").getPath(); X 不 能运行3:Thread.currentThread().getContextClassLoader().getResource("/").getPath()Thread.currentThread().getContextClassLoader().getResource("").getPath() 得到的是 ClassPath的绝对URI路径。
如:/D:/jboss-4.2.2.GA/server/default/deploy/hp.war/WEB-INF/classes/Thread.currentThread().getContextClassLoader().getResource(".").getPath() 得到的是 项目的绝对路径。如:/D:/jboss-4.2.2.GA/server/default/deploy/hp.war在本地运行中1:this.getClass().getClassLoader().getResource("").getPath(); this.getClass().getClassLoader().getResource(".").getPath(); 得到的是 ClassPath的绝对URI路径。
如:/D:/myProjects/hp/WebRoot/WEB-INF/classesthis.getClass().getClassLoader().getResource(".").getPath(); X 不 能运行2:this.getClass().getResource("").getPath(); this.getClass().getResource(".").getPath(); 得到的是当前类 文件的URI目录。如:/D:/myProjects/hp/WebRoot/WEB-INF/classes/com/jebel/helper//D:/myProjects/hp/WebRoot/WEB-INF/classes/ 得到的是 ClassPath的绝对URI路径。
如:/D:/myProjects/hp/WebRoot/WEB-INF/classes3:Thread.currentThread().getContextClassLoader().getResource(".").getPath()Thread.currentThread().getContextClassLoader().getResource("").getPath() 得到的是 ClassPath的绝对URI路径。
如:/D:/myProjects/hp/WebRoot/WEB-INF/classesThread.currentThread().getContextClassLoader().getResource("/").getPath() X 不 能运行最后在Web应用程序中,我们一般通过ServletContext.getRealPath("/")方法得到Web应用程序的根目录的绝对路径。还有request.getContextPath(); 在Weblogic中要用request.getServletContext().getContextPath();但如果打包成war部署到Weblogic服务器,项目内部并没有文件结构的概念,用这种方式是始终得到null,获取不到路径,目前还没有找到具体的解决方案。
src路径怎么写
1. html中img的src相对路径怎么写
html中img的src相对路径的写法:同一个目录的文件引用---直接写引用文件名即可。
如果源文件和引用文件在同一个目录里,直接写引用文件名即可,这时引用文件的方式就是使用相对路径。例如:我们现在建一个源文件info.html,在info.html里要引用index.html文件作为超链接。
假设info.html路径是:c:/Inetpub//jebel/helper/this.getClass().getResource(".").getPath(); X 不 能运行3:Thread.currentThread().getContextClassLoader().getResource("/").getPath()Thread.currentThread().getContextClassLoader().getResource("").getPath() 得到的是 ClassPath的绝对URI路径。
如:/D:/jboss-4.2.2.GA/server/default/deploy/hp.war/WEB-INF/classes/Thread.currentThread().getContextClassLoader().getResource(".").getPath() 得到的是 项目的绝对路径。如:/D:/jboss-4.2.2.GA/server/default/deploy/hp.war在本地运行中1:this.getClass().getClassLoader().getResource("").getPath(); this.getClass().getClassLoader().getResource(".").getPath(); 得到的是 ClassPath的绝对URI路径。
如:/D:/myProjects/hp/WebRoot/WEB-INF/classesthis.getClass().getClassLoader().getResource(".").getPath(); X 不 能运行2:this.getClass().getResource("").getPath(); this.getClass().getResource(".").getPath(); 得到的是当前类 文件的URI目录。如:/D:/myProjects/hp/WebRoot/WEB-INF/classes/com/jebel/helper//D:/myProjects/hp/WebRoot/WEB-INF/classes/ 得到的是 ClassPath的绝对URI路径。
如:/D:/myProjects/hp/WebRoot/WEB-INF/classes3:Thread.currentThread().getContextClassLoader().getResource(".").getPath()Thread.currentThread().getContextClassLoader().getResource("").getPath() 得到的是 ClassPath的绝对URI路径。
如:/D:/myProjects/hp/WebRoot/WEB-INF/classesThread.currentThread().getContextClassLoader().getResource("/").getPath() X 不 能运行最后在Web应用程序中,我们一般通过ServletContext.getRealPath("/")方法得到Web应用程序的根目录的绝对路径。还有request.getContextPath(); 在Weblogic中要用request.getServletContext().getContextPath();但如果打包成war部署到Weblogic服务器,项目内部并没有文件结构的概念,用这种方式是始终得到null,获取不到路径,目前还没有找到具体的解决方案。
src的路径怎么写
1. html中img的src相对路径怎么写
html中img的src相对路径的写法:同一个目录的文件引用---直接写引用文件名即可。
如果源文件和引用文件在同一个目录里,直接写引用文件名即可,这时引用文件的方式就是使用相对路径。例如:我们现在建一个源文件info.html,在info.html里要引用index.html文件作为超链接。
假设info.html路径是:c:/Inetpub//jebel/helper/this.getClass().getResource(".").getPath(); X 不 能运行3:Thread.currentThread().getContextClassLoader().getResource("/").getPath()Thread.currentThread().getContextClassLoader().getResource("").getPath() 得到的是 ClassPath的绝对URI路径。
如:/D:/jboss-4.2.2.GA/server/default/deploy/hp.war/WEB-INF/classes/Thread.currentThread().getContextClassLoader().getResource(".").getPath() 得到的是 项目的绝对路径。如:/D:/jboss-4.2.2.GA/server/default/deploy/hp.war在本地运行中1:this.getClass().getClassLoader().getResource("").getPath(); this.getClass().getClassLoader().getResource(".").getPath(); 得到的是 ClassPath的绝对URI路径。
如:/D:/myProjects/hp/WebRoot/WEB-INF/classesthis.getClass().getClassLoader().getResource(".").getPath(); X 不 能运行2:this.getClass().getResource("").getPath(); this.getClass().getResource(".").getPath(); 得到的是当前类 文件的URI目录。如:/D:/myProjects/hp/WebRoot/WEB-INF/classes/com/jebel/helper//D:/myProjects/hp/WebRoot/WEB-INF/classes/ 得到的是 ClassPath的绝对URI路径。
如:/D:/myProjects/hp/WebRoot/WEB-INF/classes3:Thread.currentThread().getContextClassLoader().getResource(".").getPath()Thread.currentThread().getContextClassLoader().getResource("").getPath() 得到的是 ClassPath的绝对URI路径。
如:/D:/myProjects/hp/WebRoot/WEB-INF/classesThread.currentThread().getContextClassLoader().getResource("/").getPath() X 不 能运行最后在Web应用程序中,我们一般通过ServletContext.getRealPath("/")方法得到Web应用程序的根目录的绝对路径。还有request.getContextPath(); 在Weblogic中要用request.getServletContext().getContextPath();但如果打包成war部署到Weblogic服务器,项目内部并没有文件结构的概念,用这种方式是始终得到null,获取不到路径,目前还没有找到具体的解决方案。
3. jsp img src 路径该怎么写
如果是本路径下的IMG,不需要引入相对路径,因为默认就会在当前路径下找相应的图片。
举例:<div class="zj02"><img src="zj_01.gif" /></div>;
备注:如果是同级文件路径的话,那么就需要引入相对上级路径的自路径。
举例:<div class="zj02"><img src="../images/zj_01.gif" /></div>;
此时说明是此图片是jsp上级路径的同级路径“images”文件夹下面的文件
src=路径怎么写
1. html中img的src相对路径怎么写
html中img的src相对路径的写法:同一个目录的文件引用---直接写引用文件名即可。
如果源文件和引用文件在同一个目录里,直接写引用文件名即可,这时引用文件的方式就是使用相对路径。例如:我们现在建一个源文件info.html,在info.html里要引用index.html文件作为超链接。
假设info.html路径是:c:/Inetpub//jebel/helper/this.getClass().getResource(".").getPath(); X 不 能运行3:Thread.currentThread().getContextClassLoader().getResource("/").getPath()Thread.currentThread().getContextClassLoader().getResource("").getPath() 得到的是 ClassPath的绝对URI路径。
如:/D:/jboss-4.2.2.GA/server/default/deploy/hp.war/WEB-INF/classes/Thread.currentThread().getContextClassLoader().getResource(".").getPath() 得到的是 项目的绝对路径。如:/D:/jboss-4.2.2.GA/server/default/deploy/hp.war在本地运行中1:this.getClass().getClassLoader().getResource("").getPath(); this.getClass().getClassLoader().getResource(".").getPath(); 得到的是 ClassPath的绝对URI路径。
如:/D:/myProjects/hp/WebRoot/WEB-INF/classesthis.getClass().getClassLoader().getResource(".").getPath(); X 不 能运行2:this.getClass().getResource("").getPath(); this.getClass().getResource(".").getPath(); 得到的是当前类 文件的URI目录。如:/D:/myProjects/hp/WebRoot/WEB-INF/classes/com/jebel/helper//D:/myProjects/hp/WebRoot/WEB-INF/classes/ 得到的是 ClassPath的绝对URI路径。
如:/D:/myProjects/hp/WebRoot/WEB-INF/classes3:Thread.currentThread().getContextClassLoader().getResource(".").getPath()Thread.currentThread().getContextClassLoader().getResource("").getPath() 得到的是 ClassPath的绝对URI路径。
如:/D:/myProjects/hp/WebRoot/WEB-INF/classesThread.currentThread().getContextClassLoader().getResource("/").getPath() X 不 能运行最后在Web应用程序中,我们一般通过ServletContext.getRealPath("/")方法得到Web应用程序的根目录的绝对路径。还有request.getContextPath(); 在Weblogic中要用request.getServletContext().getContextPath();但如果打包成war部署到Weblogic服务器,项目内部并没有文件结构的概念,用这种方式是始终得到null,获取不到路径,目前还没有找到具体的解决方案。
转载请注明出处育才学习网 » htmlsrc路径怎么写
育才学习网