1

The content variable even with a window in front of it, is not known to the second function that tries to use it. What am I doing wrong?

<button id="button" onclick="myFunction();">Button</div>

function MyFunction(){
window.content = "Hello";    
chi();
}

function chi() {
var MyNewVar = content;    
alert(MyNewVar);
}

http://jsfiddle.net/DN3yC/10/

Brandon
  • 311
  • 2
  • 16

0 Answers0