全局变量和局部变量 案例

来源:互联网 发布:方正排版印刷软件 编辑:程序博客网 时间:2024/06/05 21:39
<!DOCTYPE>
<html>
<body>
<headlang="en">
<metacharset="UTF-8">
<title></title>
</head>
<script>
varx="a";
functiontext(){
x="b";
}
text();
alert (x);

functiontext2(){
varx;
x= c;
}
text2();
alert (x);


</script>
</body>
</html>