Hi, this is probably quite a basic one, but I'm struggling to get an argument passed in to a function successfully.
When I do this, the code doesn't execute:
Doing this instead works fine:Code:document.onclick = newTarg(5); document.ondblclick = newTarg(10); function newTarg(spd) { alert('Working = '+spd); // More code here }
Any ideas why it won't let me pass a variable in? I've never really formally learnt Javascript so this is getting a bit frustrating...Code:document.onclick = newTarg; function newTarg() { alert('Working'); // More code here }


Reply With Quote
Bookmarks