1. <head>
  2. </head>
  3. <body>
  4. <!-- The onclick attribute is the code
  5. that happens when the element is clicked.
  6. The value of the attribute is some
  7. javascript code.
  8. In this case it creates an alert
  9. pop up dialog
  10. -->
  11. <h1 id="title" onclick="alert('hello');" >
  12. Hello
  13. </h1>
  14. </body>
  1. <head>
  2. </head>
  3. <body>
  4. <!--
  5. In this case the onclick functions
  6. writes something to the console.
  7. The console is an object so we use the
  8. dot (.) notation to call a function
  9. on it
  10. -->
  11. <h1 id="title"
  12. onclick="console.log('hello');" >
  13. Hello
  14. </h1>
  15. </body>

  I don't know does the code " console.log('hello') " whether means make a object(console) do sth.?

2.How to use the jQuery

  1. <head>
  2. <!-- to use jQuery we need to import it like this -->
  3. <script src=" http://code.jquery.com/jquery-1.11.3.min.js"></script>
  4. </head>
  5. <body>
  6. <!--
  7. in this example use use jQuery to
  8. change the content itself.
  9. The $ is shorthand for the jQuery function
  10. We are passing in a CSS selector which
  11. gets this element by its id.
  12. The html function sets the html content
  13. of an element
  14. -->
  15. <h1 id="title" onclick="$('#title').html('Goodbye');">
  16. Hello
  17. </h1>
  18. </body>

3.How to define a function in javaScript

  1. <head>
  2. <script src = "http://code.jquery.com/jquery-1.11.3.min.js"></script>
  3. </head>
  4. <body>
  5. <h1 id="title" onclick="sayHello()"> Hello </h1>
  6. </body>
  7. <!--
  8. the script tag is where you can put
  9. more complex scripts
  10. -->
  11. <script type="text/javascript">
  12. function sayHello() {
  13. alert('Hello');
  14. };
  15. </script>

2016 - 1 - 27 javaScrip初步(一)的更多相关文章

  1. 2016.9.27 --- changchun

    1001 Hanzo vs. Genji 1002 Fraction 1003 Rotate String 1004 Triangle 1005 The Fastest Runner Ms. Zhan ...

  2. 2016 - 1 - 25 CSS初步 (二)

    1.The customising link We can change the link's style when we move our pointer on the link like that ...

  3. 2016 08 27 印刷菜单增加sql语句

    insert into `module` (`ID`, `CONSONANTCODE`, `CREATEDATE`, `DESCRIPTION`, `HANDLER`, `HASCHILD`, `IC ...

  4. 2016.8.27 JavaScript入门之四

    1.比较运算符“>”也可以,用数字和字符串进行比较: 2.比较运算符“&&”,表示并且: 3.比较运算符“||”,表示或者: 4.顺序是重要的,循环和if判断的顺序决定了,程序的 ...

  5. 2016.5.27 php测试中敏感度高,怎么调整

    在测试PHP代码的过程中,会遇到这样的问题:PHP提示Notice: Undefined variable,遇到这样的问题很纠结,但是很容易解决. 今天晚上,我就遇到了这样的问题,到网上搜索了很多解决 ...

  6. 2016.5.27 Kal系统安装到U盘的方法,U盘启动Kali

    本文我们聊一下如何把Kali Linux安装到移动硬盘或者U盘上,由移动硬盘独立引导,与本地系统完全隔离.U盘随身携带,只要PC的Bios支持USB启动,走到哪都可以使用自己的移动系统,方便工作和学习 ...

  7. Day3~Day7(2016/1/23~2016/1/27)

    活动的生命周期:onCreate();onStart();onResume();onPause();onStop();onDestroy();onRestart(); 活动的启动模式:standard ...

  8. 2016 - 1 - 24 CSS初步

    1.The difference between CSS and HTML HTML document is that it specities the content of the page. An ...

  9. 27、初步探索echarts源码

    1.首先发现随笔中凡是和echarts相关的点击率都特别高,于是乎就接着写了echarts因为感觉要转点击率 首先声明我并不是专业做前端的,所以如果有些说得不对的地方,希望前端大神们出来指正 首先发现 ...

随机推荐

  1. SSH框架总结

    首先,SSH是由多个框架(struts+spring+hibernate)的集成,是目前较流行的一种Web应用程序开源集成框架,用于构建灵活.易于扩展的多层Web应用程序. 集成SSH框架的系统从职责 ...

  2. Laravel RuntimeException inEncrypter.php line 43: The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths

    php artisan key:generate 运行上面代码即可解决

  3. lua实现私有函数

    本文是原创文章,如需转载,请注明文章出处 要用lua实现私有函数,关键就是使用metatable的特性来实现. Test.lua: local v = {};v.x = 100;v.y = 200; ...

  4. springMVC 错误页面配置

    在Spring MVC应用程序中,404 error code 被合适的配置.web.xml文件中配置如下所示: <!-- spring mvc start --> <servlet ...

  5. WDA导出文件XLS,WORD

    METHOD ONACTIONEXCEL . DATA: LO_NODE TYPE REF TO IF_WD_CONTEXT_NODE, "Node LO_ELEM TYPE REF TO ...

  6. 《Linux内核设计与实现》课本第五章学习笔记——20135203齐岳

    <Linux内核设计与实现>课本第五章学习笔记 By20135203齐岳 与内核通信 用户空间进程和硬件设备之间通过系统调用来交互,其主要作用有三个. 为用户空间提供了硬件的抽象接口. 保 ...

  7. 无废话SharePoint入门教程五[创建SharePoint页面布局]

    一.前言 文章成体系,如果有不明白的地方请查看前面的文章. 二.目录 1.创建页面布局 2.首次使用页面布局 3.修改页面布局 4.使用页面布局 5.最终效果 1.创建页面布局 (1)打开设计管理器, ...

  8. AppFog免费云空间申请及安装wordpress(图文教程)

    AppFog是一家提供运算平台的服务,用户可以在上面搭建自己的Web App.原本它的名字为PHPFog,但在采用了Cloud Foundry的代码作为核心,支持多个编程语言后,选择了更名.AppFo ...

  9. Format函数

    Format是一个很常用,却又似乎很烦的方法,本人试图对这个方法的帮助进行一些翻译,让它有一个完整的概貌,以供大家查询之用: 首先看它的声明: function Format(const Format ...

  10. 在APACHE服务器上的访问方式上去除index.php

      在APACHE服务器上的访问方式上去除index.php   下面我说下 apache 下 ,如何 去掉URL 里面的 index.php 例如: 你原来的路径是: localhost/index ...