<html>
<head>
<script>
function myfunction()
{
var x=document.getElementById("img1").name;
document.getElementById("demo").innerHTML = x;
var y=document.getElementById("img1").src;
document.getElementById("demo1").innerHTML = y;
}
</script>
</head>
<body>
<p id="demo"></p>
<p id="demo1"></p>
<img src="E:/Sample Pictures/1.jpg" name="photo" width="500px" height="400" onclick="myfunction()" id="img1">
</body>
</html>