images

+3 william appiah-dankwah · February 15, 2015
i want to place an image in javascript how do you do that? does anyone know? 

Post a Reply

Replies

- page 2
Oldest  Newest  Rating
0 william appiah-dankwah · March 20, 2015

Var image = new image;

image.src = "pic/image.jpeg";

document.body.appendChild(image);

0 william appiah-dankwah · March 20, 2015
@michal walker na never worked there's another way though
0 william appiah-dankwah · March 20, 2015
Why is it append child Michael walker I can't see the parent last child relationship in that code :)
0 michael walker · March 20, 2015
Here bro: 

<script type="text/javascript"> 
//this creates the variable
var image = new Image;
 //this is where you get the image note Images/tut.jpg is my path to image.
image.src = "Images/tut.jpg"; - you must place your own path to point to the image
//code that adds it to your webpage
document.body.appendChild(image);

</script>
0 william appiah-dankwah · March 17, 2015
do you literally have to put in the path to pic?
0 william appiah-dankwah · March 4, 2015

function Blue(){
var Pic_on = new image(256, 189)
Pic_on.src = "image.jpg";

Document.write(Pic_on.src);

}

This just  tells you were that image is when you use document.write();

document.write(); is just used for testing
i want the image to display









0 william appiah-dankwah · March 4, 2015
U don't know what it's for @abhinav
0 william appiah-dankwah · March 4, 2015
Not with document.write
0 Abhinav Shukla · March 4, 2015
 You can use html code to put a image in javascript. You put it in the document.write section.
For an example
document.write("");
0 william appiah-dankwah · March 3, 2015
Why isn't that code working?

Javascript

107,228 followers
About

A scripting language that is added to standard HTML to create interactive effects, apps, games for the browser.

Links
Moderators