Troubles in js exercises

simple text movement via js

html file

    if(!document.getElementById) return false;
    if(!document.getElementById("message")) return false;
    var elem = document.getElementById("message");
    elem.style.position = "absolute";
    elem.style.left = "50px";
    elem.style.top = "100px";
    moveElement("message",200,100,10);
}

addLoadEvent (positionMessage);
the effect you want to achieve is text movement
, but in fact positiMessage successfully calls
but no text movement effect occurs;
and the browser reports an error [Web browser] "Uncaught SyntaxError: Unexpected number" (1)

May.28,2021

JSBIN

you have a big problem with this code. You don't consider the direction

. < hr >

modified a place

clipboard.png


:

clipboard.png
this place is supposed to concatenate it into a "moveElement ('message',200,100,10)" . If you remove this single quote, the splicing will become "moveElement (message,200,100,10)" , and then when setTimeout is called, it will become
new Function ("moveElement (message,200,100,10)") (),. At this time message is just a meaningless character, not a global variable, so the program goes wrong

.
Menu