惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog RSS Feed
博客园 - 叶小钗
F
Fortinet All Blogs
GbyAI
GbyAI
Martin Fowler
Martin Fowler
博客园 - 聂微东
I
InfoQ
B
Blog
IT之家
IT之家
美团技术团队
L
LangChain Blog
小众软件
小众软件
C
Check Point Blog
MongoDB | Blog
MongoDB | Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
V
V2EX
Last Week in AI
Last Week in AI
A
About on SuperTechFans
博客园 - Franky
P
Proofpoint News Feed
罗磊的独立博客
月光博客
月光博客
V
Visual Studio Blog
MyScale Blog
MyScale Blog

博客园 - 上善若水

Struts2页面显示缓慢 JavaScript核心基础知识学习一 转帖 SQL Server数据库开发注意事项 如果你恨一个人... WebSphere6.1 JSP 源码级别问题 Struts2的类型转换器 技巧记录 一个私有的PageLoad在Mono下引发的问题 如何写一个不带BOM的UTF8文件 常用.Net正则表达式 一个大小写引起的SVN无法Commit的问题 Asp.Net 国际化问题 在Asp.Net移动窗体中不可以使用<%=%> 如何返回一个服务器相对路径到客户端的相对路径 动态的向内容页中添加样式表 VS的生成后事件命令行示例 发现自己的BLOG被转载了 移动WEB开发之浏览器文件定义 查询Mysql的数据架构信息研究
JavaScript基础知识学习二
上善若水 · 2009-09-09 · via 博客园 - 上善若水

一 变量

在函数体内部使用var关键字定义的为本地变量

二 数值

Math.round(), Math.floor(), and Math.ceil()

Math.random()

Math.abs()

toFixed()

parseInt() and parseFloat()

三 字符串

可以使用单引号或双引号,字符串中的引号有必要的话,需要使用转义

String对象可用方法和属性

length,indexOf() and lastIndexOf(),charAt(),substring(),split(),toLowerCase(),toUpperCase()

四 结构控制

if,elseif ,switch(switch必须具有同样的数据类型,类似于===)

for,while,do while,break and continue

try catch finally

五 函数

函数也可以作为变量传递

六 Object

七 事件注册

1 Inline event handlers <a href="somewhere.html" onclick="highlightNavItem()">

2 The traditional model

<a href="somewhere.html" id="somewhere">

var x = document.getElementById('somewhere');

x.onclick = highlightNavItem; // note: no parentheses

3 Executing event handlers directly

x[i].onkeyup = x[i].onchange = checkMaxLength;

x[i].onkeyup();

4 Anonymous functions

5 W3C and Microsoft models