Last active
July 31, 2017 18:52
-
-
Save jdh8/0fae34538548134f3e234c7fcb3aa616 to your computer and use it in GitHub Desktop.
八字命學
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 八字命學(stdlib) | |
{ | |
"use asm"; | |
function main() | |
{ | |
} | |
return main; | |
} | |
var 八字 = 八字命學(this); | |
八字(); | |
if (!("valueAsDate" in HTMLInputElement.prototype)) { | |
Object.defineProperty(HTMLInputElement.prototype, "valueAsDate", { | |
get: function() { return new Date(this.value) }, | |
set: function(date) { | |
switch (false) { | |
case date instanceof Date: | |
throw TypeError("Value being assigned to HTMLInputElement#valueAsDate must be a date."); | |
default: | |
this.value = date.toISOString().replace(/T.*/, ""); | |
} | |
} | |
}) | |
} | |
document.querySelector("button").addEventListener("click", function() | |
{ | |
console.log(document.querySelector("input").valueAsDate); | |
}); |
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
<html> | |
<head> | |
<meta charset="UTF-8"> | |
</head> | |
<body> | |
<input> | |
<button type="button">計算</button> | |
<script src="8char.js"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment