Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML File Paths
File path in a website is the location of a file in that website. This path might be relative (in reference to current path) or absolute (full URL of file).
Syntax
Following is the syntax:
1) Relative path
src="ImgFolder/picture.jpg"
Or
src="../ImgFolder/picture.jpg"
Or
src="/ImgFolder/picture.jpg"
2) Absolute path
src="http://www.tutorialspoint.com/html5/foo.mp4"
Let us see an example of HTML DOM Video src property−
Example
<!DOCTYPE html>
<html>
<head>
<title>HTML DOM Video src</title>
<style>
* {
padding: 2px;
margin:5px;
}
form {
width:70%;
margin: 0 auto;
text-align: center;
}
input[type="button"] {
border-radius: 10px;
}
</style>
</head>
<body>
<form>
<fieldset>
<legend>HTML-DOM-Video-src</legend>
<video id="wordPressIntro" width="320" controls src="http://www.tutorialspoint.com/html5/foo.mp4" type="video/mp4"> </video><br>
<input type="button" onclick="getTrackDetails()" value="Get URL">
<input type="text" id="textSelect" placeholder="Full Name...">
<div id="divDisplay">
</div>
</fieldset>
</form>
<script>
var divDisplay = document.getElementById("divDisplay");
var textSelect = document.getElementById("textSelect");
var wordPressIntro = document.getElementById("wordPressIntro");
function getTrackDetails() {
if(textSelect.value === 'admin')
divDisplay.textContent = 'Video URL: '+wordPressIntro.src;
else
divDisplay.textContent = 'Cannot Provide URL, Unauthorized User';
}
</script>
</body>
</html>
Output
This will produce the following output −
1) Before clicking ‘Get URL’ button −

2) After clicking ‘Get URL’ button−

Advertisements