I created one js file which has code to change the image source
function profilefill() {
//alert("Ok In...");
document.getElementById('profile').src = 'profileicon.png';
}
Then I created two web pages one contain a button and a reference to the js file
<button id="signin" onclick="profilefill()" style="height: 40px; width: 90px; margin-top: 5px;
background-color: black; color:white;">Sign in</button>
<script src="profilescript.js"></script>
And another file where I want to change the image I was given a reference of js file same as previous but the image is not getting displayed.