answersLogoWhite

0

You change the src attribute of the picture. For example:

function changeMyPicture()

{

var myPicture=document.getElementsByTagName("img")[0];

//The line of code above refers to the first img element in the

//page; Change it to refer to the picture you want to change.

var newPictureURL="http:\/\/example.com/example.png";

//The line of code above refers to the URL of the picture you

//want to change the original picture to.

myPicture.src=newPictureURL;

}

User Avatar

Wiki User

13y ago

What else can I help you with?