w3schools
  
HOME HTML CSS XML JAVASCRIPT ASP PHP SQL MORE...   References Examples Forum About
BEST WEB HOSTING JustHosts

Image src Property


Image Object Reference Image Object

Definition and Usage

The src property sets or returns the URL of an image.

Note: This property can be changed at any time. However, the new image inherits the height and width attributes of the original image.

Syntax

imageObject.src=URL


Example

Example

<html>
<head>
<script type="text/javascript">
function changeSrc()
  {
  document.getElementById("myImage").src="hackanm.gif"
  }
</script>
</head>
<body>

<img id="myImage" src="compman.gif" width="107" height="98" />
<br /><br />
<input type="button" onclick="changeSrc()" value="Change image">

</body>
</html>

Try it yourself »


Image Object Reference Image Object

WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Top 10 Web Hosting
UK Reseller Hosting
Web Hosting
FREE Web Hosting
Top Web Hosting
Cheap UK Web Hosting
WEB BUILDING
XML Editor – Free Trial!
FREE Flash Website
FREE Web Templates
SEO Company
EDUCATION
US Web Design Schools
HTML Certification
JavaScript Certification
XML Certification
PHP Certification
ASP Certification
STATISTICS
Browser Statistics
Browser OS
Browser Display
FLIGHT TICKETS
Find the cheapest flight
to any destination now!
SHARE THIS PAGE