By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,341 Members | 1,700 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,341 IT Pros & Developers. It's quick & easy.

Creating DIV Tag

P: n/a
Create Javascript object Box and move it

Object Box should create new HTML elements DIV on page.
Quantity of Boxes on the page is unlimited.
DIV should have:
1. absolute position;
2. background color: red;
3. padding 20px;

Do not use document.write, innerHTML, insertAdjacentHTML.

Box(BoxCount, width, height, left, top)
myBox.moveBox(left, top)

BoxCount - text inside of DIV, counting Box number ("Box: " + i)
width, height - size of DIV
left, right - position of DIV on page

All boxes can have the same size, position and move to the same
Important: Size of Boxes on monitor screen should be
the same in Internet Explorer and Mozilla Firefox.

Example javascript:
var myBox = new Box("Count: " + i, 80, 60, 100, 100);
myBox.moveBox(300, 200)

Example HTML:
<input type='button' value='Add new box' >
<input type='button' value='Move new box' >
// your code here

Jun 27 '08 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Let me guess, this is your homework?

Most forums will not assist you unless you make an effort to solve it
yourself first.

If you have a specific question, ask away.
Jul 15 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.