can someone explain to me fundamentally what this does?
<a href="
javascript:
myFunction();">
I assume that the first part "
javascript" is calling
my javascript up in the header?
<script type="text/javascript"></script>
And
myFunction is calling a function that is within that script?
So hypothetically, if I did this, then it's the same philosophy?
<script type="text/whatever"></script>
<a href="whatever:myFunction();">
Also, why is it that when calling a function outside of the
javascript tags, you use the parenthesis "()"..
But within it, you don't? Like this...
Code:
<script type="text/javascript">
var clickCount = 0;
function documentClick(){
document.getElementById('clicked').value = ++clickCount;
}
document.onclick = documentClick;
</script>
How come:
document.onclick = documentClick;
Doesn't use parenthesis? Shouldn't it be?
document.onclick = documentClick();