W
W
wolf-98302014-03-29 21:35:00
Java
wolf-9830, 2014-03-29 21:35:00

How to change image coordinates in javascript?

Hello! I have a question for you: I need to change the coordinates of an image that I inserted using a tag and edited in a css file using javascript, how can I do this?
My code:

<div id="box1" onclick="show_text('box1');">
  <img src="box1.png">

and the show_text function itself is here:
box1 = document.getElementById('box1');

function show_text(button_id)
{
if(button_id == 'box1')
{
document.getElementById('text').innerHTML = '<p>Текст</p>';
}

}

In general, I need to change the coordinates of box1, how to do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BIG_bu, 2014-03-30
@wolf-9830

box1.style.position = "absolute";
box1.style.top = "100px";
box1.style.left = "200px";

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question