www.webdeveloper.com
Results 1 to 4 of 4

Thread: How to display image with javascript?

  1. #1
    Join Date
    Dec 2011
    Posts
    68

    How to display image with javascript?

    how display the images by setting a size limit using with java script?

  2. #2
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,377
    You don't need JS to do this unless you want to change after the page has been rendered.
    Code:
    <img src="imageFilename.jpg" height="100" width="100">
    Give an example of what you are trying to do.

  3. #3
    Join Date
    Dec 2011
    Posts
    22
    Code:
    var a = document.createElement("img");
    a.src = "myimg.png";
    a.height = 100;
    a.width = 100;

  4. #4
    Join Date
    Jan 2009
    Location
    Insanity
    Posts
    1,131
    Also background loading....
    Code:
    img = new Image;
    img.src = "path/to/image.jpg";
    img.height = 150; // optional, will default to image size
    img.width = 150; //       ---- " ----
    We all have baggage to carry in life, unfortunately for me I always get the trolley with the wonky wheel...
    Code:
    Youre = {
          STILL_not_getting_it:function(){
               alert("YOU, the original poster / thread starter NEED to POST the code and NOT a LINK.");
          },
          MissingThePoint:function(msg){
                alert("You're missing the point. " + msg);
          }
    }
    Youre.STILL_not_getting_it();

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles