Need help with moving a div

Discussion in 'Java' started by wirelessbass, Mar 20, 2015.

  1. wirelessbass


    Mar 20, 2015
    Likes Received:
    So in my program, divs are randomly created at different positions, but all with the same class. I am trying to get it so when ever one of the divs is created, they instantly begin to move to the left. I have this code
    function ballleft() {
    var ball = parseInt(document.getElementByClassName("ball").style.left);
    document.getElementByClassName("ball").style.left = (ball - 10) + px;

    function startBallMove() {
    ball = document.getElementsByClassName("ball");
    for (var i=0; i < ball.length; i++) {
    but it won't move the ball, is this because there is something wrong with the code or is it because startBallMove() is not actually being called. Thanks for the help.
    wirelessbass, Mar 20, 2015
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.