首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

JSON基础入门实战讲解()基础+实例1(原力计划的啊)

是为了方便js获取的哈,我举个例子把,好吧,比如我叫陈业贵,你不知道我的名字能找到我吗?答案是不能是吧,一样的啦 记住哈,json的意思就是js代表javascript,o代表对象,n代表符号,也是一种字符把,哈哈哈 他代表一种数据交互的格式, 问题:格式是什么? 是一种方式,也就是说是模式把,也就是说是一种类型把懂了把哈哈哈 记住哈,它是以对象的方式来展示的 问题来了,兄弟们 以对象的形式是不是可以写属性和方法啊,老师(下面介绍) 没错,同学们,你们very good! document.getElementById(“x01”).innerHTML=ren.xing; document.getElementById(“m01”).innerHTML=ren.ming; 核心是什么?核心是把值赋值给div的中间也就是内容啊,兄弟们。 记住:兄弟们,json的!!!标准写法!!!是属性用双引号括起来,记住,是属性!!!!那么这时候问题来了, 属性值呢? 用什么? 如果要是数字什么都不要用,单单写就可以,如果是字符就要用双引号了,哈 注意点:外面也可以用单引号括起来, 兄弟们,请记住,如果属性单单写也不报错, 属性值字符串一定要用引号括起来哈,你不会连这一点都不懂把呵呵 那么这里问题来了,为什么属性值字符要用引号括起来呢,呵呵,因为他是字符啊,你不知道字符串字符吗,兄弟!

02

javascript当中局部变量和全局变量

2)局部变量和全局变量 浏览器里面 window 就是 global,通常可以省。 nodejs 里没有 window,但是有个叫 global 的。 例 3.2.1 <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> </head> <script> /* 有var无var, 在function外是一样的,都是全局的,在function里面时,var是局部的,而无var时是代表全局的*/ var testVar = "全量"; document.writeln("window.testVar is" + window.testVar+testVar); var testqVar = "全量q"; /*如不屏蔽下句话,程序直接停在这了,因为出错了,不认识testGlobal,得把下一句和下下句换一下位置,就ok了 */ // document.writeln("testGlobal is" + testGlobal); testGlobal = "全量global"; document.writeln("abc is" + abc); var abc; testGlobalInVar = "全量globalInVar"; function testSco() { var lll = "qqq"; var testVar = "局量"; //此testVar非外面的testVar testqVar = "全量qchange"; //此testqVar就是外面的testqVar testGlobal = "全量globalchange"; var testGlobalInVar = "局量global";//此testGlobalInVar非外面的testGlobalInVar /*local variable is stronger than global variable.so "testVar" in the following statement means local variable.*/ document.writeln(testVar); document.writeln(testqVar); document.writeln("testGlobalInVar is " + testGlobalInVar); } testSco(); document.writeln("second test is " + testVar); document.writeln("second testqVar is " + testqVar); document.writeln("testGlobal is " + testGlobal); document.writeln("testGlobalInVar is " + testGlobalInVar); </script>

00
领券