Image.src
JavaScript 1.1+, JScript 1.0+ Nav3+, IE 3+, Opera3+ Syntax
image.src
Description
The src property of the Image object specifies the URL of the image. This property can only be set by the SRC attribute of the <img> tag.
Example
Listing 7.315 displays the URL of the image.
Listing 7.315 Example of the src Property
<html> <head> <title>Example of src property</title> </head> <img name="circle" src="circle.gif"><br> <script language="JavaScript"> <!-- Hide //Display the URL of the image document.write("The URL of the image is "); document.write("<i><b>",document.circle.src,"</b></i>"); //Hide End ---> </script> </html> |
Get Pure JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.