Here are some ideas:
- Use either tab or, preferably, 4-spaces for indention consistently. Right now the indention is all screwy on JSBin.
- Put all your variable declarations at the top, even if you don't define them yet. This'll prevent any confusion from variable hoisting variable hoisting.
- Since
null
is a falsy value, you can changedocument.getElementById(...) !== null
todocument.getElementById(...)
to check for the existence of an element in youif
statements. - Space out your
if
statements (soif (...)
instead ofif(...)
.) - Maybe think about using jQuery? It'll make working with events and elements much easier than using the DOM directly. So for example, hiding all the pages could be written as easy as:
$('div').hide()
.
That's all I have time for now!
Here are some ideas:
- Use either tab or, preferably, 4-spaces for indention consistently. Right now the indention is all screwy on JSBin.
- Put all your variable declarations at the top, even if you don't define them yet. This'll prevent any confusion from variable hoisting.
- Since
null
is a falsy value, you can changedocument.getElementById(...) !== null
todocument.getElementById(...)
to check for the existence of an element in youif
statements. - Space out your
if
statements (soif (...)
instead ofif(...)
.) - Maybe think about using jQuery? It'll make working with events and elements much easier than using the DOM directly. So for example, hiding all the pages could be written as easy as:
$('div').hide()
.
That's all I have time for now!
Here are some ideas:
- Use either tab or, preferably, 4-spaces for indention consistently. Right now the indention is all screwy on JSBin.
- Put all your variable declarations at the top, even if you don't define them yet. This'll prevent any confusion from variable hoisting.
- Since
null
is a falsy value, you can changedocument.getElementById(...) !== null
todocument.getElementById(...)
to check for the existence of an element in youif
statements. - Space out your
if
statements (soif (...)
instead ofif(...)
.) - Maybe think about using jQuery? It'll make working with events and elements much easier than using the DOM directly. So for example, hiding all the pages could be written as easy as:
$('div').hide()
.
That's all I have time for now!
Here are some ideas:
- Use either tab or, preferably, 4-spaces for indention consistently. Right now the indention is all screwy on JSBin.
- Put all your variable declarations at the top, even if you don't define them yet. This'll prevent any confusion from variable hoisting.
- Since
null
is a falsy value, you can changedocument.getElementById(...) !== null
todocument.getElementById(...)
to check for the existence of an element in youif
statements. - Space out your
if
statements (soif (...)
instead ofif(...)
.) - Maybe think about using jQuery? It'll make working with events and elements much easier than using the DOM directly. So for example, hiding all the pages could be written as easy as:
$('div').hide()
.
That's all I have time for now!
default