# 事件源对象

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. c\c++复习基础要点08--c++单例模式

    单例模式有许多种实现方法,在c++中,甚至可以直接用一个全局变量做到这一点,但是这样的代码显得不优雅.使用全局对象能够保证方便地访问实例,但是不能保证只声明一个对象——也就是说除了一个全局实例外,仍然 ...

  2. [ES6] Promise

    How to use: export default function getReplies(topicId){ return new Promise(function( resolve, rejec ...

  3. pwn学习之dl_resolve学习篇

    一:首先来了解一下linux下常见的攻击缓解机制: CANARY:(金丝雀值,指的是矿工曾利用金丝雀来确认是否有气体泄漏,如果金丝雀因为气体泄漏而中毒死亡,可以给矿工预警),类似于windows GS ...

  4. 部署hibernate框架项目时出现问题:The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files.

    基本情况: (这些其实关系不大)我是直接impor导入HibernateDemo项目到eclipse中的,该项目的hibernate版本是3.6.7.Final版,使用了Hibernate Tools ...

  5. lvs+keep搭建高可用web服务

    title: lvs+keep搭建高可用web服务 date: 2015-11-26 22:11:55 tags: --- 第一部分 概念 负载均衡 生产环境下必不可少的基础手段当前大部分互联网都使用 ...

  6. 知问前端--Ajax

    本节课主要是创建一个问题表,将提问数据通过 ajax 方式提交出去.然后对内容显示进行布局,实现内容部分隐藏和完整显示的功能. 一.Ajax 提问创建一个数据表:question,分别建立:id.ti ...

  7. 使用F#开发量化模型都缺什么?

    量化模型多数是基于统计的,因此,统计运算库应该是必备的.在Matlab.R中包含了大量的统计和概率运算,可以说拿来就用,非常方便,相比之下,F#的资源就很少了,这里给大家提供几个链接,可以解决一部分问 ...

  8. 掌众android面试题

    1,android动画分类? http://www.cnblogs.com/angeldevil/archive/2011/12/02/2271096.html 2,android service启动 ...

  9. How to start the Virtualbox VMs under terminal

    Since we have servral machine on my testbed(fedora), and if I need start some VMs on that, I have to ...

  10. C#学习笔记之结构体

    1.概述 结构是一种与类相似的数据类型,不过它较类更为轻量,一般适用于表示类似Point.Rectangle.Color的对象.基本上结构能办到的类全都能办到,但在某些情况下使用结构更为合适,后面会有 ...