Skip to content

Instantly share code, notes, and snippets.

@jdh8
Last active July 31, 2017 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdh8/0fae34538548134f3e234c7fcb3aa616 to your computer and use it in GitHub Desktop.
Save jdh8/0fae34538548134f3e234c7fcb3aa616 to your computer and use it in GitHub Desktop.
八字命學
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);
});
<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