易截截图软件、单文件、免安装、纯绿色、仅160KB

javascript速记手册


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[i].type ==


相关文档:

通过javascript获得url参数

页面提交数据一般有两种方法:get,post。post就是所谓的form提交,使用视图;get是通过url提交。
Get方法一般用后台代码(如asp,asp.net)获得参数,代码很简单:Request.QueryString["id"];即可获取。 
有些时候需要直接在前台获取url参数,要用到javascript,js没有直接获取url参数的方法,那么,我们如何通过js ......

JavaScript验证函数大全

1. 长度限制
<script>
function test()
{
if(document.a.b.value.length>50)
{
alert("不能超过50个字符!");
document.a.b.focus();
return false;
}
}
</script>
<form name=a onsubmit="return test()">
<textarea name="b" cols="40" wrap="VIRTUAL" rows="6"></textarea& ......

javascript鼠标双击时触发事件大全4

javascript事件列表解说
事件 浏览器支持 解说
一般事件 onclick IE3、N2 鼠标点击时触发此事件
ondblclick IE4、N4 鼠标双击时触发此事件
onmousedown IE4、N4 按下鼠标时触发此事件
onmouseup IE4、N4 鼠标按下后松开鼠标时触发此事件
onmouseover IE3、N2 当鼠标移动到某对象范围的上方时触发此事件
onmou ......

javascript 验证代码整理

//the common event,If your brower is firefox,you should use this function instead of "window.event"
function getEvent() {
if(document.all)
return window.event; //get ie event
func=getEvent.caller;
while(func!=null) {
......

javascript验证3

/*
    限制输入字符的位数
    str是用户输入字符串,len是要限制的位数
    ----------------------------
*/
function isSmall(str,len){
    if (str.length<len){
        return(true);
  &nb ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号