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=function(){ | |
//获取页面元素 | |
var aBtn=document.getElementsByTagName("button"); | |
var box=document.getElementById("box"); | |
var tip=document.getElementById("tips"); | |
//定义三个函数,用三种方式循环改变背景颜色 | |
var fn=[function(){ | |
//第一种,遍历取出数组中的颜色值 | |
var colors=['yellow','red','black','blue','green']; | |
var i=0; |
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=function(){ | |
var oBtn=document.getElementsByTagName("button")[0]; | |
oBtn.onclick=function(){ | |
changeLineColor(document.getElementById("num").value); | |
} | |
changeLineColor(); | |
}; | |
function changeLineColor(num){ | |
var n=Number(num)>0 && Number(num)<6?Number(num):2; | |
var colors=["yellow","red","blue","green","grey"]; |
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=function(){ | |
var tab=document.getElementById("tab"); | |
var a=tab.getElementsByTagName("a"); | |
var div=tab.getElementsByTagName("div"); | |
for(var i=0;i<a.length;i++){ | |
a[i].index=i; | |
a[i].onmouseover=function(){ | |
for(var j=0;j<a.length;j++){ | |
a[j].className=""; |
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=function(){ | |
var table=document.createElement("table"); | |
for(var i=1;i<10;i++){ | |
var tr=document.createElement("tr"); | |
if(i%2==0){ | |
tr.className="dark"; | |
}else{ | |
} | |
for(var j=1;j<i+1;j++){ | |
var td=document.createElement("td"); |
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
define([ | |
'jquery' | |
], function ( | |
$ | |
) { | |
var STARTED = false; |
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
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
[Bugtags startWithAppKey:@"APP_KEY" invocationEvent:BTGInvocationEventBubble]; | |
return YES; | |
} |
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.Lib = function(){ | |
var h1 = document.createElement('h1') | |
h1.textContent = 'Hello World' | |
document.body.appendChild(h1) | |
} | |
window.Lib() |
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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
</head> | |
<body> | |
<script src="//shadow.elemecdn.com/zcache/gl/god-dev/perf-js@2.1.3/dist/perf.min.js"></script> |
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
const fs = require('fs') | |
class FakeDatabase { | |
constructor(dbPath) { | |
this._filePath = dbPath || './data.json' | |
this._data = JSON.parse(fs.readFileSync(this._filePath)) | |
this._idBase = Math.max.apply(null, this._data.map(i => i.id)) | |
} | |
_idGen() { |
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 lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no,viewport-fit=cover"> | |
<title>Document</title> | |
<style> | |
* { | |
margin: 0; | |
padding: 0; |
OlderNewer