# 事件源对象

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. [MVC4-基礎] 從資料庫取值顯示在DropDownList中

    剛開始學MVC4,以下是一些基礎的學習筆記! 完成效果像下面這樣,資料來源是既有的Database. 1.Controller public ActionResult Index() { SqlCon ...

  2. Jquery JSOPN在WebApi中的问题

    1. 客户端代码: $.ajax({ data: { name: 'zhangsan' }, url: apiUrl.getTwo('TestFourth'), dataType: 'jsonp', ...

  3. Zookeeper+Kafka+Storm+HDFS实践

    Kafka是一种高吞吐量的分布式发布订阅消息系统,它可以处理消费者规模的网站中的所有动作流数据. Hadoop一般用在离线的分析计算中,而storm区别于hadoop,用在实时的流式计算中,被广泛用来 ...

  4. JS将图片文件转为64位字符串再post到接口上传图片

    HTML: <div class="ai-item upload-id-img"> <p>上传身份证照片</p> <div class=& ...

  5. EasyUi DataGrid中数据编辑方式及编辑后数据获取,校验处理

    EasyUi中的DataGrid提供前台编辑的相关函数. 实现客户选中DataGrid中一列后,对选中列中的一个字段进行编辑,并对数据进行实时校验后,传递至后台保存的需求, 主要涉及到DataGrid ...

  6. [Mugeda HTML5技术教程之6]添加元素

    我们上节讲了怎么创建新作品.新作品创建好后,我们就可以在里面添加内容了.这一节,我们将要讲述如何在作品中添加元素.动画的中的内容都是以各种元素的形式组成的.对于添加到舞台上的元素,我们可以在时间线上添 ...

  7. 《图解CSS3》——笔记(二)

    作者:大漠 勘误:http://www.w3cplus.com/book-comment.html 2014年7月15日15:58:11 第二章  CSS3选择器 2.1  认识CSS选择器 2.1. ...

  8. C程序设计语言练习题1-5

    练习1-5 修改温度转换程序,要求以逆序(即按照从300度到0度的顺序)打印温度转换表. 代码如下: #include <stdio.h> // 包含标准库的信息. int main() ...

  9. uC/OS-II中的时间 (转)

    时间是一个非常重要的概念,我们和朋友出去游玩需要约定一个时间,做事情也需要花费一段时间,总之,我们的生活离不开时间.操作系统也一样,也需要一个时间来规范其任务的执行. 我们生活中,时间的最小单位是秒, ...

  10. Cisco Anyconnect Secure Mobility Client

    Backup 进入安装文件目录cd anyconnect-3.1.00495/binary 安装sudo./vpnsetup.sh 查看安装情况ps aux  |  grep  cisco 在搜索中, ...