The use of href and src is simple, but sometimes it suddenly can't remember how to use, and the two can not replace each other , listed below to facilitate the memory, and give specific differences.
Use of href:
1. External CSS reference: <link type= "Text/css" rel= "stylesheet" href= ". /css/test.css "/>
Use of 2.<a> Tags:<a href="http://www.baidu.com" target="_blank">百度</a>
3.the onclick event in input type is button, etc.: <input type=button onclick= "Window.location.href (' # ')"/>
Use of SRC:
- Introduce image img:
- Scirpt script:
<script type="text/javascript" src="org.js"></script>
- iframe frame : <iframe src= "Girl.gif" ></iframe>
- The type in input is the submit button for Image: <input type= "image" Src= "1.png" alt= "Submit"/>
- Vidio elements in HTML5:<video src= "Movie.ogg" controls= "controls" >video elements </video>
- Audio elements in HTML5:<audio src= "someaudio.wav" >audio elements </audio>
- Embed elements in HTML5:<embed src= "Horse.wav"/>
The difference between href and src:
the SRC (Source) property embeds only the current resource to the location defined by the current document element. When the browser finds <script src= "Script.js" ></script>, the loading and processing of the page will be paused before the browser downloads, compiles, and executes the file. This process is similar to putting the JS file in the <script> tab. This is also recommended to put the JS file to load the bottom of the reason. Of course, the IMG tab is similar to this. The browser pauses loading until the image is extracted and loaded.
Usage scenarios for href and SRC