title: How do I create several ifs and elses?
body: <p>I'm new to javascript and I have this jQuery that replaces one image when the screen size is shrunk down to 480px. The thing is that I'd like to add a lot more images to do the same thing.
  The only solution i got to work was to paste the code over and over again and replace the image values with new ones.
  So how can I create several ifs and elses in the same script?</p>
  
  <pre><code>$(document).ready(function() {  
  
  function imageresize() {  
  var contentwidth = $('body').width();  
  if ((contentwidth) &lt; '480'){  
  $('.spelguide').attr('src','bilder/480/spelguide.jpg');  
  } else {  
  $('.spelguide').attr('src','bilder/spelguide.jpg');  
  
  }  
  }  
  
  imageresize();//Triggers when document first loads      
  
  $(window).bind("resize", function(){//Adjusts image when browser resized  
  imageresize();  
  });  
  
  });  
  </code></pre>