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

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返回当前浏览器用户代标


相关文档:

JavaScript CSS Style属性对照表

JavaScript代码
<mce:script type="text/javascript"><!--
function imageOver(e) {
e.style.border="1px solid red";
}
function imageOut(e) {
e.style.borderWidth=0;
}
// --></mce:script>
<img src="phplamp.gif" onmouseover="imageOver(this)" onmo ......

JavaScript in 10 Steps or Less

没有按别人的推荐,学什么圣经类的js书,而是随便挑了本《JavaScript in 10 Steps or Less》。
花了3个小时,看了30个task。
讲的非常浅显详细。虽然是E文,但很浅显易懂。
task31:
Calling Functions from Tags
One of the benefits of JavaScript is to be able to tie interactivity to elements of the HTML page. ......

JavaScript 中使用 replace 达到 replaceAll的效果

JavaScript 中使用 replace 达到 replaceAll的效果
方法: string.replace(new RegExp(oldString,"gm"),newString))
gm     g=global, m=multiLine  ,  大致上方法就是这样的,可以实现替换全部指定字串
另一个简单的验证JS的方法:
在浏览器地址栏输入
javascript:alert("abcabc ......

JavaScript真正的鼠标放上动画加载大图的代码

<!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 ......

用JavaScript获取Gridview中某个触发事件控件的ID

今天在开发过程中遇到要用Js代码获取GridView中某个触发事件控件的ID,本人过去没有这样做过,这个问题在那时把我给难住了。
在网上找了好半天,终于是功夫不负有心人,答案还是让我给找到了!这也要感谢那个回帖的好心人。
解决方法就是:window.event.srcElement.id ,它可以当前获得触发事件控件的ID,控件知道了 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号