# 事件源对象

event.srcElement.tagName

event.srcElement.type

# 捕获释放

event.srcElement.setCapture();

event.srcElement.releaseCapture();

# 事件按键

event.keyCode

event.shiftKey

event.altKey

event.ctrlKey

# 事件返回值

event.returnValue

# 鼠标位置

event.x

event.y

# 窗体活动元素

document.activeElement

# 绑定事件

document.captureEvents(Event.KEYDOWN);

# 访问窗体元素

document.all(“txt”).focus();

document.all(“txt”).select();

# 窗体命令

document.execCommand

# 窗体 COOKIE

document.cookie

# 菜单事件

document.oncontextmenu

# 创建元素

document.createElement(“SPAN”);

# 根据鼠标获得元素:

document.elementFromPoint(event.x,event.y).tagName==”TD

document.elementFromPoint(event.x,event.y).appendChild(ms)

# 窗体图片

document.images[索引]

# 窗体事件绑定

document.onmousedown=scrollwindow;

# 元素

document.窗体.elements[索引]

# 对象绑定事件

document.all.xxx.detachEvent(‘onclick’,a);

# 插件数目

navigator.plugins

# 取变量类型

typeof($js_libpath) == “undefined”

# 下拉框

下拉框.options[索引]

下拉框.options.length

# 查找对象

document.getElementsByName(“r1″);

document.getElementById(id);

# 定时

timer=setInterval(‘scrollwindow()’,delay);

clearInterval(timer);

# UNCODE编码

escape() ,unescape

# 父对象

obj.parentElement(dhtml)

obj.parentNode(dom)

# 交换表的行

TableID.moveRow(2,1)

# 替换CSS

document.all.csss.href = “a.css”;

# 并排显示

display:inline

# 隐藏焦点

hidefocus=true

# 根据宽度换行

style=”word-break:break-all”

# 自动刷新

<meta HTTP-EQUIV=”refresh” CONTENT=”8;URL=http://c98.yeah.net”>

# 简单邮件

<a href=”mailto:aaa@bbb.com?subject=ccc&body=xxxyyy”>

# 快速转到位置

obj.scrollIntoView(true)

# 锚

<a name=”first”>

<a href=”#first”>anchors</a>

# 网页传递参数

location.search();

# 可编辑

obj.contenteditable=true

# 执行菜单命令

obj.execCommand

# 双字节字符

/[^\x00-\xff]/

汉字

/[\u4e00-\u9fa5]/

# 让英文字符串超出表格宽度自动换行

word-wrap: break-word; word-break: break-all;

# 透明背景

<IFRAME src=”1.htm” width=300 height=180 allowtransparency></iframe>

# 获得style内容

obj.style.cssText

# HTML标签

document.documentElement.innerHTML

# 第一个style标签

document.styleSheets[0]

# style标签里的第一个样式

document.styleSheets[0].rules[0]

# 防止点击空链接时,页面往往重置到页首端。

<a href=”javascrīpt:function()”>word</a>

# 上一网页源

asp:

request.servervariables(“HTTP_REFERER”)

javascrīpt:

document.referrer

# 释放内存

CollectGarbage();

# 禁止右键

document.oncontextmenu = function() { return false;}

# 禁止保存

<noscrīpt><iframe src=”*.htm”></iframe></noscrīpt>

# 禁止选取<body oncontextmenu=”return false” ondragstart=”return false” onselectstart =”return false” onselect=”document.selection.empty()” oncopy=”document.selection.empty()” onbeforecopy=”return false”onmouseup=”document.selection.empty()>

# 禁止粘贴

<input type=text ōnpaste=”return false”>

# 地址栏图标

<link rel=”Shortcut Icon” href=”favicon.ico”>

favicon.ico 名字最好不变16*16的16色,放虚拟目录根目录下

# 收藏栏图标

<link rel=”Bookmark” href=”favicon.ico”>

# 查看源码

<input type=button value=查看网页源代码 ōnclick=”window.location = ‘view-source:’+ ‘http://www.csdn.net/'”>

# 关闭输入法

<input style=”ime-mode:disabled”>

# 自动全选

<input type=text name=text1 value=”123″ ōnfocus=”this.select()”>

# ENTER键可以让光标移到下一个输入框

<input ōnkeydown=”if(event.keyCode==13)event.keyCode=9″>

# 文本框的默认值

<input type=text value=”123″ ōnfocus=”alert(this.defaultValue)”>

# title 换行

obj.title = “123&#13sdfs&#32″

# 获得时间所代表的微秒

var n1 = new Date(“2004-10-10″.replace(/-/g, “\/”)).getTime()

# 窗口是否关闭

win.closed

# checkbox扁平

<input type=checkbox style=”position: absolute; clip:rect(5px 15px 15px 5px)”><br>

# 获取选中内容

document.selection.createRange().duplicate().text

# 自动完成功能

<input type=text autocomplete=on>打开该功能

<input type=text autocomplete=off>关闭该功能

# 窗口最大化

<body ōnload=”window.resizeTo(window.screen.width – 4,window.screen.height-50);window.moveTo(-4,-4)”>

# 无关闭按钮IE

window.open(“aa.htm”, “meizz”, “fullscreen=7″);

# 统一编码/解码

alert(decodeURIComponent(encodeURIComponent(“http:// 你好.com?as= hehe”)))

encodeURIComponent对”:”、”/”、”;” 和 “?”也编码

# 表格行指示

<tr ōnmouseover=”this.bgColor=’#f0f0f0′” ōnmouseout=”this.bgColor=’#ffffff'”>

PC-JS小技巧的更多相关文章

  1. [转载]Js小技巧||给input type=“password”的输入框赋默认值

    http://www.cnblogs.com/Raywang80s/archive/2012/12/06/2804459.html [转载]Js小技巧||给input type="passw ...

  2. js小技巧总结

    js小技巧总结 1.Array.includes条件判断 function test(fruit) { const redFruits = ["apple", "stra ...

  3. html/css/js小技巧实例

    一些学习中碰到的小技巧 让div自动撑起来: .clearfix:after{ content: "."; clear: both; display: block; visibil ...

  4. javascript小技巧-js小技巧收集(转)

    本文转载自:http://blog.csdn.net/ocean20/article/details/2498699 每一项都是js中的小技巧,但十分的实用! 1.document.write(&qu ...

  5. JS小技巧大本事(持续更新)

    1. 复制N个字符 String.prototype.repeat = function(num){ return (new Array(++num)).join(this); } var a = ' ...

  6. 可以提升幸福感的js小技巧(下)

    4.数字 4.1 不同进制表示法 ES6中新增了不同进制的书写格式,在后台传参的时候要注意这一点. 29 // 10进制 035 // 8进制29 原来的方式 0o35 // 8进制29 ES6的方式 ...

  7. js小技巧

    js判断字符长度 直接使用String对象的属性,空格亦算一个字符 myString = "Hello world"; length = myString.length js比较字 ...

  8. js 小技巧

    如果想让js每次加载时,都要执行, 那么在 <script type="text/javascript" >中加一个属性reload="1", &l ...

  9. 一些CSS/JS小技巧

    CSS部分 1.文本框不可点击 .inputDisabled{ background-color: #eee;cursor: not-allowed;} 2.禁止复制粘贴 onpaste=" ...

  10. 【JS小技巧】JavaScript 函数用作对象的隐藏问题

    用户反馈 @消失的键盘 在论坛反馈了一个问题,在 AppBoxMvc 中的 Title 模型中,如果将 Name 属性改名为小写的 name 属性,就会报错: 因为这是一个 ASP.NET MVC 的 ...

随机推荐

  1. 二十六个月Android学习工作总结

    1.客户端的功能逻辑不难,UI界面也不难,但写UI花的时间是写功能逻辑的两倍. 2.写代码前的思考过程非常重要,即使在简单的功能,也需要在本子上把该功能的运行过程写出来. 3.要有自己的知识库,可以是 ...

  2. 关于ubuntu16.04给firefox安装flash的补充

    这两天把自己的老笔记本安装了ubuntu的16.04版本,关于给firefox安装flash player的方法,网上有很多,但不知道是版本还是其它原因,他们文章都出现目录错误的问题,我个人由于是ub ...

  3. C复习手记(Day2)

    1.共用体 共用体是一种特殊的结构,允许在相同的位置存储不同的数据类型.可以定义一个带有多成员的共同体,但是任何时候只能有一个成员带有值. 定义共用体: union Data { int i; flo ...

  4. C#获取当前路径的几种方法

    C#获取当前路径的方法如下: 1. System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName -获取模块的完整路径. 2. ...

  5. chkconfig(check config)命令

    功能说明:chkconfig命令主要用来更新(启动或停止)和查询系统服务的运行级信息.谨记chkconfig不是立即自动禁止或激活一个服务,它只是简单的改变了符号连接.  语 法:chkconfig ...

  6. Android系统中长按事件的实现机制解析

    在Android的触摸消息中,已经实现了三种监测,它们分别是 1)pre-pressed:对应的语义是用户轻触(tap)了屏幕 2)pressed:对应的语义是用户点击(press)了屏幕 3)lon ...

  7. Mac os 上可执行jar包转app方法

    此操作可分如下几步: 1:生成jarbao: jar cf myName.jar *.class 2:生成打包所需配置文件:build.xml: <project name="MyPr ...

  8. HTML学习笔记之meta标签

    一.meta标签的组成 meta标签共有两个属性,它们分别是http-equiv属性和name属性,不同的属性又有不同的参数值,这些不同的参数值就实现了不同的网页功能. 1.name属性 name属性 ...

  9. JQuery获取当前屏幕的高度宽度

    JQuery获取浏览器窗口宽高,文档宽高的代码,使用jquery的朋友可以参考下. <script type="text/javascript"> $(document ...

  10. c# 基础复习1

    1. 类和对象 1.1 类和对象的概念 类:对象的类型,它不同于 int 等基本数据类型,因为类具有行为:也可以说是具有相 同特征和行为的一组对象的集合. 对象:对象是一个个你能看得见,摸得着的实体, ...