Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About rclancy

  • Rank

Previous Fields

  • Languages
    I used to do C/C++ and Ruby, but it's been a while.
  1. It's good to remember that 'y++' (and '++y') is shorthand for the expression 'y=y+1'. This expression contains an '=' which assigns a new value to 'y' before assigning that value to 'x'. if you want to leave 'y' unchanged try 'var x = y+1;'.
  2. Ok, this works: function useless() {return theRealFunction;}function theRealFunction() {//actual code here}window.onload = useless(); So that must be what's going on. Thanks for your help!
  3. Thanks for the reply! Let me see if I understand... The reason "window.onload = someFunction();" fails isn't a scope issue, it fails because the function is called before the document is created and then assigned to "window.onload" which then does it's thing. While "window.onload = someFunction;" doesn't execute the function, it just tells "window.onload" the name of the function to be run once the document is ready.
  4. Hey, This seems like a basic question, but I can't find any information on it. (Perhaps my google-fu is weak) When calling a function, what is the difference between "someFunction();" and "someFunction;"? It seems like they should be similar, but they are not interchangeable. Consider the following code: <!DOCTYPE html><html><head><title>Playing Around...</title><script> function theMain() { //Display the current time. function displayTime() { var elt = document.getElementById("clock"); var now = new Date(); elt.innerHTML = now.toLocaleTimeStr
  • Create New...