This file contains 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
// ucs-2 string to base64 encoded ascii | |
function utoa(str) { | |
return window.btoa(unescape(encodeURIComponent(str))); | |
} | |
// base64 encoded ascii to ucs-2 string | |
function atou(str) { | |
return decodeURIComponent(escape(window.atob(str))); | |
} | |
// Usage: | |
utoa('✓ à la mode'); // 4pyTIMOgIGxhIG1vZGU= |
This file contains 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> | |
<head> | |
<meta charset="utf-8" /> | |
<title>getUserMedia</title> | |
</head> | |
<body> | |
<video id="camera"></video> | |
<script> | |
document.addEventListener('DOMContentLoaded', onDOMContentLoaded, false); |
This file contains 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> | |
<head> | |
<title>Form Serialization</title> | |
</head> | |
<body> | |
<form action="form.php" method="post"> | |
<input type="hidden" name="hiddeninput" value="hidden value" /> | |
Name:<input type="text" name="username" /><br /> | |
Pass:<input type="password" name="userpassword" /> <br /> |
This file contains 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> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Js图片无缝滚动</title> | |
<style type="text/css"> | |
body{ | |
background:gray; | |
} | |
#wrap{ |
This file contains 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
/* Firefox /NS6 properties for determining browser dimension */ | |
window.innerHeight; // Returns the physical height of the browser screen | |
window.innerWidth; // Returns the pyhsical widht of the browser screeen | |
/* IE 4+ properties for determining browser dimension */ | |
document.body.clientWidht; // Returns physical width of the browser screen | |
document.body.clientHeight; // Returns the physical height of the browser screen | |
/* Firefox / NS6+ properties for determining DSOC */ | |
window.pageXOffset; // Returns the x coordinate of the DSOC |
This file contains 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
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
This file contains 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
#loadbar { | |
width: 280px; | |
background-color: #000; | |
border: 1px solid #000; | |
} | |
#bar { | |
display: block; | |
font-family: arial; | |
font-size: 12px; | |
background-color: #00d0ff; |
This file contains 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> | |
<head> | |
<title>Window onload event</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
</head> | |
<body> | |
<div>TODO write content</div> | |
<img src="1.jpg" alt="1.jpg" width="200" height="200" id="pic"><br> | |
<script src="slide.js"></script> |
This file contains 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
function addOnload(newFunction) { | |
var oldOnload = window.onload; | |
if(typeof oldOnload === "function") { | |
alert("OldOnload is not null"); | |
window.onload = function() { | |
if (oldOnload) { | |
alert("OLD found, Let do OLD"); | |
oldOnload(); | |
} | |
alert("Do new function"); |
NewerOlder