If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

Need Help Centering Javascript Objects

Hi I am very new to JavaScript and have been playing around with customizing this code all afternoon. I've finally sorted the more complicated details out, but I cannot get the JavaScript object to center align on the page and it's driving me crazy. I finally managed to get the object in the middle of the page by adjusting the margins but it is not perfectly centered. The page is located here.

For a conference I am attending, we are giving away prizes to everyone who signs up to our mailing list. We needed a way to randomly give away a number of different small prizes (of which we have varying quantities of) and make a fun game out of it. We are using a dice roll & the probability of rolling each combination to determine who wins what prize. I've figured out how to get the animated dice to be centered, but the button to "Roll Dice Again" is not centered underneath the dice. How do I fix the button so that it is also centered?

I've named the JavaScript object in a div tag in the HTML as #DiceRoll. The CSS is here:

D6Animator.prototype.nope = function(msg) {
if (msg) {
alert(msg + "\n\n(If you're not the developer for this application, please contact the owner of this website!)");
} else {
alert("Either your browser can't handle this application, or there's a bug.\nEither way, you're out of luck right now.\nIf you think this is a bug, please contact the owner of this site!");
}
return false;
}

// Below is the high level dice roller code, which is much simpler
// to use than all the low level stuff above. Of course, using
// the low level stuff gives you a lot more flexibility in what
// you do, but the following D6 class will still allow you
// to do quite a lot.