javascript common
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= "字符 ";
21.弹出提示信息:window.alert( "字符 ");
22.弹出確认框:window.confirm();
23.弹出输入提示框:window.prompt();
24.指定当前显示链接的位置:window.location.href= "URL "
25.取出窗体中的所有表单的数量:document.forms.length
26.关闭文档的输出流:document.close();
27.字符串追加连接符: =
28.创建一个文档元素:document.createElement(),document.createTextNode()
29.得到元素的方法:document.getElementById()
30.设置表单中所有文本型的成员的值为空:
var form = window.document.forms[0]
for (var i = 0; i <form.elements.length;i ){
if (form.elements.type == "text "){
form.elements.value = " ";
}
}
31.复选按钮在JS中判定是否选中:document.forms[0].checkThis.checked (checked属性代表为是否选中返回TRUE或FALSE)
32.单选按钮组(单选按钮的名称必须相同):取单选按钮组的长度document.forms[0].
相关文档:
JavaScript页面刷新与弹出窗口问题解决方法
1.无提示刷新网页
大家有没有发现,有些网页,刷新的时候,会弹出一个提示窗口,点“确定”才会刷新。
而有的页面不会提示,不弹出提示窗口,直接就刷新了.
如果页面没有form,则不会弹出提示窗口。如果页面有form表单,
a)< form method="post" ...&g ......
一、功能实现核心:FileSystemObject 对象
要在javascript中实现文件操作功能,主要就是依靠FileSystemobject对象。
二、FileSystemObject编程
使用FileSystemObject 对象进行编程很简单,一般要经过如下的步骤: 创建FileSystemObject对象、应用相关方法、访问对象相关属性 。 ......
Array 对象
Array 对象用于在单个的变量中存储多个值。
创建 Array 对象的语法:
new Array();
new Array(size);
new Array(element0, element0, ..., elementn);
参数
参数 size 是期望的数组元素个数。返回的数组,length 字段将被设为 size 的值。
参数 element ..., elementn 是参数列表。当使用这些参数来调 ......
if (elename.equalsIgnoreCase("back") || elename.equalsIgnoreCase("1"))
return "<a href=\"javascript:window.history.back()\">后退</a>";
&nbs ......