This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body leftmargin=0 topmargin=0 oncontextmenu='return false' ondragstart='return false' onselectstart ='return false' onselect='document.selection.empty()' oncopy='document.selection.empty()' onbeforecopy='return false' onmouseup='document.selection.empty()'> | |
关键就在 | |
oncontextmenu='return false' | |
ondragstart='return false' | |
onselectstart ='return false' | |
onselect='document.selection.empty()' | |
oncopy='document.selection.empty()' | |
onbeforecopy='return false' | |
onmouseup='document.selection.empty()' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
冒泡事件就是点击子节点,会向上触发父节点,祖先节点的点击事件。 | |
下面是html代码部分: | |
<body> | |
<div id="content"> | |
外层div元素 | |
<span>内层span元素</span> | |
外层div元素 | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//获取本地IP地址 | |
var os = require('os'); | |
var IPv4,hostName; | |
hostName=os.hostname(); | |
for(var i=0;i<os.networkInterfaces().eth0.length;i++){ | |
if(os.networkInterfaces().eth0[i].family=='IPv4'){ | |
IPv4=os.networkInterfaces().eth0[i].address; | |
} | |
} | |
console.log('----------local IP: '+IPv4); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="a"> | |
<ul> | |
<li class="b">位于底部</li> | |
</ul> | |
</div> | |
<style> | |
#a{ | |
width:200px; | |
height:200px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>SimulateUpDownKeySelect</title> | |
</head> | |
<body> | |
<input type="text" id="txtInput"/> | |
<div id="divSelect"> | |
<li>123</li> | |
<li>456</li> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onload | |
必须等待网页中所有的内容加载完毕后(包括图片)才能执行 | |
不能同时编写多个,比如: | |
window.onload = function() { | |
alert("111"); | |
}; | |
window.onload = function() { | |
alert("222"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
We will create a family tree using just CSS(3) | |
The markup will be simple nested lists | |
--> | |
<div class="tree"> | |
<ul> | |
<li> | |
<a href="#">Parent</a> | |
<ul> | |
<li> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- <%= haiku.user.name %> | |
| <%= pluralize haiku.votes, "vote" %> | |
<% if current_user && current_user.can_vote_for?(haiku) %> | |
| <%= link_to "up", vote_haiku_path(haiku, value: 1), method: "post" %> | |
| <%= link_to "down", vote_haiku_path(haiku, value: -1), method: "post" %> | |
<% end %> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Date.prototype.format = function (format) { | |
/* | |
* eg:format="YYYY-MM-dd hh:mm:ss"; | |
*/ | |
var o = { | |
"M+" : this.getMonth() + 1, // month | |
"d+" : this.getDate(), // day | |
"h+" : this.getHours(), // hour | |
"m+" : this.getMinutes(), // minute | |
"s+" : this.getSeconds(), // second |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title></title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
// 下面的插件部分建议放在js文件中, 方便调用 | |
//-------------- 插件 begin ------------------ | |
(function ($) { |