Image size on random image script

Discussion in 'JavaScript' started by obeegoone, Oct 27, 2010.

  1. #1
    Hey, im trying to change the size on the images in my code, tho i cant seem to get it work :(

    Any ideas what i shoud add ?


    <script type="text/javascript"><!--
    var img = new Array();
    
    // random images (byts varje gång sidan uppdateras)
    img.push("/bikers18.jpg");
    img.push("/bikers18.jpg");
    img.push("/bikers18.jpg");
    img.push("/bikers18.jpg");
    img.push("/images/bikers18.jpg");
    
    // How many random pictures you want to display
    var num = 1;
    
    // The part where the images are randomed and printed to screen
    for(i=0;i<num;i++) {
    	rand = Math.floor(Math.random()*img.length);
    	document.write("<img src=\"" + img[rand] + "\" />");
    }
    //--></script>
    Code (markup):

     
    obeegoone, Oct 27, 2010 IP
  2. _:codefan:_

    _:codefan:_ Active Member

    Messages:
    18
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Just set the width and height
     
    _:codefan:_, Oct 27, 2010 IP