• 初识Javascript


    <head>

    <meta charset="utf-8"/>

    <title></title>

    <script>

    js代码内部引入方法1

    alert('iiii')

    alert('1234')

    </script>

    </head>

     

    <body>

    js代码内部引入方法2

    <script type='text/javascript'>

    alert('李青是猪');

    </script>

    外部引入

    <scrtpt src="script/js/名称.js" type="text/javascript" charset="utf-8"></script>

    <noscript>

    您的浏览器不支持javascript,请更换查看

    </noscript>

    行内引入

    <a href="javascript:confirm('您确认要学习Javascript吗?');">报名</a>

    <p onclick="javascript:alert('hello word');">clickMe</p>

    以上是引入方式

    <script type="text/javascript">

    var a;

    var b;

    var c,d;

    var test = 'this is a test';

    var test1 = '12';

    var test2 = 1.2;

    var test3 = true;

    var test4 = false;

    var a = b = c = d = e = 1;

    a=33;

    var username = 'king';

    var userName = 'QUEEN';

    var age = 12;

    var test5 = 'hello';

    var _test = 'hello';

    document.write('aaa');

    document.write('<br />');

    document.write('bbb');

    alert('<h1>rrrrrr</h1>')

    document.write('ccc');

    document.write('ddd');

    document.write('<br />');

    document.write('hello \

    world');\

    变量名称最好含义明确,以字母或者下划线开头,跟上数字字母下划线

    var age=12;

    var test5= 'hello';

    var 12a='bb';

    alert(12a);

    var _test='hello';

    alert(_test);

    驼峰标记法和下划线

    var firstName = 'king';//小驼峰

    var FirstName = 'queen';//大驼峰

    var first_name = 'ymt';//下划线法

    console.log('向控制台中书写内容');

    </script>

    a = 0;

    a = 0.0;

    a = 0/0;

    //alert(a);   //not a number

    //NaN

    a = NaN;

    //alert(typeof Number(NaN));

    var a ="";//空字符集->false

    //a=0;

    //a= null;

    var b=0;

    console.log( a  ==   b);

    //null  !=  0

    //null  !=  ""

    //null  ==  undefined

    //0  !=  undefined

    //" " !=  undefined

    //" " ==  0 

  • 相关阅读:
    OGG常用命令
    postgres psql常用命令学习笔记
    oracle DG搭建方式两种总结
    配置rhel系统kdump安装RHEL的debuginfo软件包
    oracle开机自启,监听自启,任意秒crontab
    cx_Oracle.DatabaseError: DPI-1047: 64-bit Oracle Client library cannot be loaded 解决方法
    rhel | centos7上配置python3环境和pip
    shared_pool知识点整理
    记一次性能测试实践3-单接口压测
    我是如何做性能测试-文档收集并深入学习
  • 原文地址:https://www.cnblogs.com/wzy123/p/11339995.html
Copyright © 2020-2023  润新知