<html>
<head>
<script type="text/javascript">
function myfunction()
{
obj = 0;
var obj1 = 0;
obj2 = 0;
document.write("before invoking<br>");
document.write("obj = "+obj+"<br>") // 0
document.write("obj1 = "+obj1+"<br>") // 0
document.write("obj2 = "+obj2+"<br>") // 0
func1();
document.write("after invoking<br>");
document.write("obj = "+obj+"<br>") // 1
document.write("obj1 = "+obj1+"<br>") // 0
document.write("obj2 = "+obj2+"<br>") // 0
}
function func1(){
obj = 1;
obj1 = 1;
var obj2 = 1;
}
</script>
</head>
<body onload="myfunction()">
</body>
</html>