Linked Questions

Popular Questions

I'm trying to change a picture in a webpage using the tag button and the onclick attribute that call a function that I did in a js document, but it isn't working, this is what a did:

in Javascript:

function store (a,z) {
  var pic;
  if (a>z) {
       pic = "images_weddings/desing_logo-01.jpg";
       pic = "images_weddings/rose1.jpg";
  document.getElementById('change1').src = pic;

and in html:


      <img src="images_weddings/desing_logo-01.png" id="change1" >

  <button type="button" onclick="store(2,3)">change the image</button>

Related Questions