introduction


    • introduction
    • 前言
      • JavaScript Display Possibilities
      • variable
      • arithmetic

前言

这几章笔记是看了翁凯老师的网上教程做的,这份教程很基础,没有学过编程的同学也可以轻松学习,并且会根据例子讲很多平常容易弄错的细节语法,而且老师声音很好,像是学过播音,让人容易听得进去课。
课程链接:http://study.163.com/course/courseMain.htm?courseId=195001

记笔记的时候在国外,电脑上装不了中文输入法,只好用英文了,markdown写的,编辑器是stackedit,很好用的一款网页编辑器,推荐。

<body onLoad="alert('hi')">
<script>
document.write('hey');
</script>
</body>

document is an object, write() is an action.
onload is an attribute of body.

notice:
1. two layers of quotation is not valid.
change one to single quotation.
2. semicolon is necessary.

JavaScript Display Possibilities

JavaScript can “display” data in different ways:

  1. Writing into an alert box, using window.alert().
  2. Writing into the HTML output using document.write(). //wipe all contents after click
  3. Writing into an HTML element, using innerHTML.
  4. Writing into the browser console, using console.log().

variable


<body>
<script>
var a = "hello"; //assignment, not equality
document.write(a);
</script>
</body>

the name of the variable can only consist of number, character, and underline.
ps: number can’t be in the first place.

arithmetic


<body>
<script>
var a = "hello";
var b ="15";
document.write(a+b);//result is hello15
</script>
</body>
  1. javascript can use “+” to append character strings.
  2. double ” ” writes as single ” ” cuz html
<body>
<script>
var a = "hello";
document.write(a >= "gello");//result is true
</script>
</body>

character string can also be compared, usually the value is based on there ASCII code.
order:
number< uppercase character< lower case character;

更多相关文章

  1. 设计html编辑器预览功能背后的理论
  2. IronPython编辑器 —— FantasyPython雏形的雏形
  3. 支持c和python之间的跨语言(c)标记的代码编辑器
  4. VIM 编辑器使用基础介绍
  5. 个人网站对xss跨站脚本攻击(重点是富文本编辑器情况)和sql注入攻击
  6. Mix-Editor图文编辑器----Android图文编辑器

随机推荐

  1. 【开发者必看】2020年移动应用趋势洞察白
  2. Redis系列5-实现简单消息队列
  3. Redis系列6 - Redis事务
  4. Redis系列二 rdb 和 aof 持久化的区别
  5. Java Volatile Atomic关键字
  6. Redis系列七 - 实现排行榜功能
  7. 一篇文章让您了解HTTPS
  8. 快速用ELK搭建日志收集平台
  9. SpringMVC源码分析:一个request请求的完整
  10. Redis系列八--Redis数据过期策略详解