标签:cti var back s函数 赋值 document write span type
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> </head> <body> <script type="text/javascript"> //变量作用域 var x=1; function test(){ document.write(‘函数体内x的值为:‘+x+‘<br/>‘); //undefined,x值取下面的,但是取不到值 var x=19; document.write(‘函数体内对x重新赋值,此时x的值为:‘+x+‘<br/>‘); //19 } document.write(‘函数体外x的值为:‘+x+‘<br/>‘); //1 test(); document.write(‘x的值为:‘+x+‘<br/>‘); //1 //document.write(‘<hr color="red"/>‘); </script> </body> </html>
标签:cti var back s函数 赋值 document write span type
原文地址:https://www.cnblogs.com/f-z-g-boke/p/9545438.html