JavaScript语法集锦
click()对象.click()使对象被点击。
closed对象.closed对象窗口是否已关闭true/false
clearTimeout(对象)清除已设置的setTimeout对象
clearInterval(对象)清除已设置的setInterval对象
confirm("提示信息")弹出确认框,确定返回true取消返回false
cursor:样式更改鼠标样式handcrosshairtextwaithelpdefaultautoe/s/w/n-resize
event.clientX返回最后一次点击鼠标X坐标值;
event.clientY返回最后一次点击鼠标Y坐标值;
event.offsetX返回当前鼠标悬停X坐标值
event.offsetY返回当前鼠标悬停Y坐标值
document.write(document.lastModified)网页最后一次更新时间
document.ondblclick=x当双击鼠标产生事件
document.onmousedown=x单击鼠标键产生事件
document.body.scrollTop;返回和设置当前竖向滚动条的坐标值,须与函数配合,
document.body.scrollLeft;返回和设置当前横向滚动务的坐标值,须与函数配合,
document.titledocument.title="message";当前窗口的标题栏文字
document.bgcolordocument.bgcolor="颜色值";改变窗口背景颜色
document.Fgcolordocument.Fgcolor="颜色值";改变正文颜色
document.linkcolordocument.linkcolor="颜色值";改变超联接颜色
document.alinkcolordocument.alinkcolor="颜色值";改变正点击联接的颜色
document.VlinkColordocument.VlinkColor="颜色值";改变已访问联接的颜色
document.forms.length返回当前页form表单数
document.anchors.length返回当前页锚的数量
document.links.length返回当前页联接的数量
document.onmousedown=x单击鼠标触发事件
document.ondblclick=x双击鼠标触发事件
defaultStatuswindow.status=defaultStatus;将状态栏设置默认显示
functionfunctionxx(){...}定义函数
isNumeric判断是否是数字
innerHTMLxx=对象.innerHTML输入某对象标签中的html源代码
innerTextdivid.innerText=xx将以div定位以id命名的对象值设为XX
location.reload();使本页刷新,target可等于一个刷新的网页
Math.random()随机涵数,只能是0到1之间的数,如果要得到其它数,可以为*10,再取整
Math.floor(number)将对象number转为整数,舍取所有小数
Math.min(1,2)返回1,2哪个小
Math.max(1,2)返回1,2哪个大
navigator.appName返回当前浏览器名称
navigator.appVersion返回当前浏览器版本号
navigator.appCodeName返回当前浏览器代码名字
navigator.userAgent返回当前浏览器用户代标
相关文档:
1. SproutCore
SproutCore 苹果对SproutCore的解释为“开源,平台无关,类Cocoa的JavaScript框架,用于创建具有桌面应用程序外观和操作感的Web应用程序。”
SproutCore demonstrations: Photos, Sample Controls
2. Spry
Spry 是Adobe 的 Ajax framework. Spry的目的是成为实现Ajax的一种简单方式,对HTML、C ......
< HTML >
< HEAD >
< TITLE > 合同申请 </ TITLE >
< meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" >
< SCRIPT LANGUAGE = JavaScript >
/* * Define object Dsy 构造器
fieldValues&nbs ......
window,是javascript中整个框架中的根。它具有如下属性和方法:
属性:location,navigate,screen,frameset[],document,history等6个重要的属性.
方法:setTineOut(),moveTo(),moveBy(),resizeBy(),resizeTo()等几个常用的方法。
请看如下两个例子:
1、状态栏动态显示年月日
function setTime() {
&n ......
This tool will let you optimize your JavaScript (JScript) code by removing comments, whitespace as well as other unnecessary characters as well as by optionally shortening function / variable / class names.
http://www.xtreeme.com/javascript-optimizer/ ......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>JavaScript真正的鼠标放上动画加载大图的代码</title>
<style>
*{ padding:0; margin ......