js常用属性

总结一些js常用属性

1.输出语句:document.write("");

2.JS中的注释为://

3.传统的HTML文档顺序是:document->html->(head,body)

4.一个浏览器窗口中的DOM顺序是:window->(navigator,screen,history,location,document)

5.得到表单中元素的名称和值:document.getElementById("表单中元素的ID号").name(或value)

6.一个小写转大写的JS: document.getElementById("output").value = document.getElementById("input").value.toUpperCase();

7.JS中的值类型:String,Number,Boolean,Null,Object,Function

8.JS中的字符型转换成数值型:parseInt(),parseFloat()

9.JS中的数字转换成字符型:(""+变量)

10.JS中的取字符串长度是:(length)

11.JS中的字符与字符相连接使用+号.

12.JS中的比较操作符有:==等于,!=不等于,>,>=,<.<=

13.JS中声明变量使用:var来进行声明

14.JS中的判断语句结构:if(condition){}else{}

15.JS中的循环结构:for([initial expression];[condition];[upadte expression]) {inside loop}

16.循环中止的命令是:break

17.JS中的函数定义:function functionName([parameter],...){statement[s]}

18.当文件中出现多个form表单时.可以用document.forms[0],document.forms[1]来代替.

19.窗口:打开窗口window.open(), 关闭一个窗口:window.close(), 窗口本身:self.

20.状态栏的设置:window.status="字符";

 

 

猜你喜欢

转载自blog.csdn.net/qq_36472252/article/details/85997109