alert
at the top of your file and/or function and see if it shows up.form
tag on your page. If you do, it will treat any button click as an attempt to submit that form, which will refresh your page.
document.getElementByID
function work?
document.getElementById
.
textarea
in my JS code?
value
, not innerHTML
, of the text area.
for
loop for animation work?
for
loop to produce animation. Use a timer with the setInterval
or setTimeout
function.
setInterval
takes a delay in milliseconds. You may need to convert one to the other.
id
or class
properties of an HTML tag in JavaScript?
.id
or .className
attributes respectively.
$
and $$
) in global variables, because you can easily access these objects again by calling $
or $$
again.
onclick
handler? $("mybutton").onclick = myFunction(42);
$("mybutton").onclick = f; ... function f() { myFunction(42); }
// anonymous function; may be bad style $("mybutton").onclick = function() { myFunction(42); };