FSWD_2_JavaScript
2015-09-22 21:57
651 查看
location
data type
data structure
Events
function
structure
debug
JS既在client side有,也在server side 和 database side有。
js库一般放在head里面
js代码一般放在body的最后面
只有一种表示,可以用科学计数法。
string
boolean
&& || !
object
var
typeof
parseInt
parseFloat
String
length
join
push
shift
pop
unshift
concat
confirm
prompt
isNaN
random
Math.random
Math.floor
function
switch break
while () {};
string.indexof(“text”) location of “text”
do {} while(); does the once at least
local and global variable
如果在函数里面使用了没有被var创建的变量a,a会变成全局变量。
同时可以在console中输入js代码
console.log()与alert()的区别是用户不可见但是开发者可见。
data type
data structure
Events
function
structure
debug
JS既在client side有,也在server side 和 database side有。
location
一般情况,js代码可以放在任何位置。js库一般放在head里面
js代码一般放在body的最后面
[code]<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <!-- LOAD JS LIBRARIES HERE --> <scrpit src="mycode.js"></scrpit> </head> <body> <!-- your js code here usually --> <script> function surprise() { alert("hello"); } </script> </body> </html>
data type
number只有一种表示,可以用科学计数法。
string
boolean
&& || !
object
var
typeof
parseInt
parseFloat
String
data structure
[]length
join
push
shift
pop
unshift
concat
[code]var a = [1,2,3]; var a = new Array(3); array.join(separator) array.length array.push array.pop array.shift array.unshift array1.concat(array2)
Events
onload is triggered when the object is loaded.[code]<body onload="alert('hello'); alert('hello2')">
function
alertconfirm
prompt
isNaN
[code]<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <script> alert("alert"); confirm("confirm"); var user_name; user_name = prompt("what's your name"); document.write("welcome to my page " + user_name +"!"); </script> </body> </html>
random
Math.random
Math.floor
[code]Math.random()*max_value #[0,max_value)
function
[code]<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <script> function user_age() { age = prompt("input your age"); return parseInt(age) } function check_age() { if (user_age() < 18) alert("go out") } </script> </head> <body onload="check_age()"> </body> </html>
structure
if elseswitch break
while () {};
string.indexof(“text”) location of “text”
do {} while(); does the once at least
local and global variable
如果在函数里面使用了没有被var创建的变量a,a会变成全局变量。
debug
使用chrome中的开发者工具同时可以在console中输入js代码
console.log()与alert()的区别是用户不可见但是开发者可见。
相关文章推荐
- 与我一起extjs5(09--其定义菜单2)
- 关于js中的闭包
- 前端开发必须掌握的七个JavaScript技巧
- jetty JSP support not configured
- JavaScript学习总结(四)function函数部分
- JavaScript返回上一页并自动刷新
- ExtJs4得知(五岁以下儿童)主要的Ext分类
- JavaScript学习总结(三)BOM和DOM详解
- JS立即执行函数
- 用Canvas+Javascript FileAPI 实现一个跨平台的图片剪切、滤镜处理、上传下载工具
- js字符串函数
- JavaScript学习总结(二)数组和对象部分
- JavaScript学习总结(一)基础部分
- JavaScript设计模式一:工厂模式和构造器模式
- EXTJS 自学2 使用面板
- Extjs 自学1
- An exception has occurred while using the formatter ‘JsonMediaTypeFormatter’ to generate sample
- JavaScript中关键字(this)
- jqMobi指南系列教程是《 jqMobi Javascript Frameworks Cheat Sheet》 的中文版
- js中的eval方法转换对象时,为何一定要加上括号?