Skip to content

Instantly share code, notes, and snippets.

@noromanba
Created September 21, 2011 11:05
Show Gist options
  • Save noromanba/1231807 to your computer and use it in GitHub Desktop.
Save noromanba/1231807 to your computer and use it in GitHub Desktop.
Hex Decimal Alternate Converter: init.
<!--
Hex Decimal Alternate Converter.
The MIT License
Copyright (c) 2011 noromanba
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@license The MIT License. http://www.opensource.org/licenses/mit-license.php
@license (Japanese Translation) http://sourceforge.jp/projects/opensource/wiki/licenses%2FMIT_license
@author noromanba
@see http://homepage1.nifty.com/mstak/Computer/JavaScript/program-form2.html
@see http://www.htmq.com/style/
@version 0.0.1
@date 2011-06-22T08:03:25+09:00
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<title>Hex<->Dec</title>
<style type="text/css">
<!--
body {
margin: 5 5 5 5;
padding: 0;
overflow: hidden;
border-style: none;
}
span.kss-had {
color: #000000; /*#000000 #ffffff;*/
font-size: 1.5em;
font-weight: normal; /* bold, normal */
font-style: normal;
font-family: 'Consolas','Incosolata',monospace;
vertical-align: top;
}
input.kss-had {
color: #000000; /*#000000 #ffffff;*/
font-size: 1.5em;
font-weight: bold; /* bold, normal */
font-style: normal;
font-family: 'Consolas','Incosolata',monospace;
}
//-->
</style>
<script type="text/javascript">
<!--
function hex2d() {
var msgr = document.messenger;
var vhex = msgr.hex.value;
msgr.dec.value = parseInt(vhex, 16);
}
function d2hex() {
var msgr = document.messenger;
var vdec = msgr.dec.value;
msgr.hex.value = parseInt(vdec, 10).toString(16);
}
(function() {
var pw = 210; // window width.
var ph = 105; // window height.
window.resizeTo(pw, ph);
//window.moveTo((screen.width - pw)/2, (screen.height - ph)/2);
})();
//-->
</script>
<hta:application
applicationName="Hex<->Dec"
border="thick"
contextMenu="yes"
icon="http://d.hatena.ne.jp/images/diary/noromanba/favicon.ico"
id="kssHad"
scroll="no"
selection="no"
singleInstance="yes"
maximizeButton="no"
version="0.0.1" />
</head>
<body>
<form name="messenger">
<div>
<span class="kss-had">hex:</span>
<input type="text" id="hex" value="" onkeyup="hex2d()" onfocus="hex2d()" size="8" maxlength="8" class="kss-had" />
</div>
<div>
<span class="kss-had">dec:</span>
<input type="text" id="dec" value="" onkeyup="d2hex()" onfocus="d2hex()" size="8" maxlength="8" class="kss-had" />
</div>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment