# 事件源对象

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. Web Service那点事

    出现 如今基于浏览器的client应用程序越来越流行,而从开发角度来看,一方面是client浏览器的安装配置不再须要我们再去花费非常大的精力.还有一方林则是由于client和server之间通信的问题 ...

  2. 基于bootstrap的datatable控件

    https://editor.datatables.net/release/DataTables/extras/Editor/examples/bootstrap.htmlhttps://github ...

  3. mvc之验证IEnumerable<T> 类型

    假设我们有这么一种需求,我们要同时添加年级和年级下面的多个班级,我们一般会像下面这种做法. Action中我们这样接收: [HttpPost] public ActionResult CreateGr ...

  4. [Angular 2] Transclusion in Angular 2

    Link: Blog Single transclude: <ng-content></ng-content> Multi-translcude: <ng-content ...

  5. uploadify3.1 参数 中文详解

    langFile: 'http://www.static-xxx.nu/uploader/uploadifyLang_en.js',//语言包的路径,能设置所有的提示文字 swf: 'http://w ...

  6. js框架页跳转

    1.跳出框架,在父页面. <script type="text/javascript"> window.parent.frames.location.href=&quo ...

  7. LINUX增加并管理用户

    使用groupadd命令增加新的用户组 使用useradd命令增加新用户: useradd -s /bin/bash -d /home/XXX -g group username 使用passwd修改 ...

  8. 关于解决方案和web文件夹放在同一目录路径错误的问题

    今天公司要做个b2b商城,下了个源码,目的是在这个基础上改,可是源码没有解决方案,于是建立了个解决方案,然后添加网站,发现解决方案和web目录位于不同目录(解决方案总是自动生成一个目录),可是我从网上 ...

  9. ADO.NET之使用DataGridView控件显示从服务器上获取的数据

    今天回顾下ADO.NET中关于使用DataGridiew控件显示数据的相关知识 理论整理: 使用 DataGridView 控件,可以显示和编辑来自多种不同类型的数据源的表格数据. SqlDataAd ...

  10. 在同个类中non-const插入const来减少重复

    class A { private: std::string a; public: A(std::string b) :a(b){} const char& operator[](int b) ...