<head>
</head> <body>
<!-- The onclick attribute is the code
that happens when the element is clicked.
The value of the attribute is some
javascript code.
In this case it creates an alert
pop up dialog
-->
<h1 id="title" onclick="alert('hello');" >
Hello
</h1>
</body>
<head>
</head>
<body>
<!--
In this case the onclick functions
writes something to the console.
The console is an object so we use the
dot (.) notation to call a function
on it
-->
<h1 id="title"
onclick="console.log('hello');" >
Hello
</h1>
</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

<head>
<!-- to use jQuery we need to import it like this -->
<script src=" http://code.jquery.com/jquery-1.11.3.min.js"></script>
</head>
<body>
<!--
in this example use use jQuery to
change the content itself.
The $ is shorthand for the jQuery function
We are passing in a CSS selector which
gets this element by its id.
The html function sets the html content
of an element
-->
<h1 id="title" onclick="$('#title').html('Goodbye');">
Hello
</h1>
</body>

3.How to define a function in javaScript

<head>
<script src = "http://code.jquery.com/jquery-1.11.3.min.js"></script>
</head> <body>
<h1 id="title" onclick="sayHello()"> Hello </h1>
</body>
<!--
the script tag is where you can put
more complex scripts
-->
<script type="text/javascript"> function sayHello() {
alert('Hello');
};
</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. MySQL TCL 整理

    TCL(Transaction Control Language)事务控制语言SAVEPOINT 设置保存点ROLLBACK  回滚SET TRANSACTION

  2. ArcGIS创建tpk切片缓存

    一. 背景知识 1. tpk是什么? 从地图或底图生成切片,并将切片进行打包从而创建单个压缩的 .tpk 文件.切片包(.tpk)是在地图或栅格数据集中能作为 Web 切片或 Web 高程图层发布的一 ...

  3. 即时反应的input和propertychange方法

    在web开发中,我们有时会需要动态监听输入框值的变化,当使用onkeydown.onkeypress.onkeyup作为监听事件时,会发现一些复制粘贴等操作用不了,同时,在处理组合快键键的时候也很麻烦 ...

  4. LR录制Flex+Web,登录功能之登录密码出错的处理

    在LR中录制好更改密码脚本,Controller中使用少量用户进行:单用户多迭代.多用户单迭代.多用户多迭代,运行正常,于是使用490Vuser+2iteration修改980个用户的密码,部分 Vu ...

  5. css权值计算

    外部样式表<内部样式表<内联样式: HTML 标签选择器的权值为 1: Class 类选择器的权值为 10: ID 选择器的权值为 100: 内联样式表的权值最高 1000: !impor ...

  6. lesson32 Shopping for food

    EMPLOYEE: undefined763cff06-f7fc-4a01-b5f8-c78a2f0110ae.mp3 Can I help you, Sir? 0先生,我能帮你吗? BOB: und ...

  7. KMS安装后激活机器

    slmgr /skms 192.168.26.82 slmgr /ato

  8. 开启LOH压缩?

    我们知道.NET CLR的GC堆中有一种特殊的堆,它专门存放超过85000byte的对象(详见这里),这就是大对象堆(LOH). 在.NET Framework 4.5.1之前,微软并没有提供对LOH ...

  9. dll版本冲突的解决方法

    问题描述 当运行站点或者控制台等程序时,如果项目引用的dll版本与其它dll所依赖的dll版本不一致,就会报未能加载程序集的错误.错误信息为: 未能加载文件或程序集"Newtonsoft.J ...

  10. Windows中一个22年的漏洞

     X Windows系统,今天作为世界各地的Linux桌面,已经存在超过20年了,仍然存在Bug.几天前Sysadmins为libXfont库提供了补丁,来对应新发现的已经在代码中存在了22年的特权升 ...