从美国东部时间上午 11 点开始,我一直在研究这个:/
无法找出我错了,我的 java/jquery 不存在(试图拿起它)
我想做的是根据几个变量计算莱特币每天的数量。
LTC/day = (50) * (24) * (24) ) / (User_hash/net_hash)
IE:
(block * 24 * 24) / (mhs / $ltcdiff) = LTC/day or total text field
这是代码,任何关于它的说明都会很棒,我正试图让它在您在该字段中输入 mhs 速率时实时更新。
<?
$jsonurl = "http://www.litehosting.org/API/LTC/litecoin.php";
$json = file_get_contents($jsonurl,0,null,null);
$data = json_decode($json, true);
$dat = $data['return']['getinfo'];
$ltcdiff = $dat['difficulty'];
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
$('input').keyup(function(){
var mhs = $('input[name="hash"]').val(),
diff = $('input[name="diff"]').val(),
block = ('50'),
result;
if (mhs != "" && diff != "" && block != ""){
result = ((block*24) * (24)) / ((mhs) / (diff));
$('input[name="total"]').val(result);
}
});
</script>
</head>
<body>
<h1>LTC example</h1>
<form name="myForm">
<P> mh/s: </P>
<input type="text" name="hash"><BR>
<P> diff: </P>
<input type="text" name="diff" value="<? echo $ltcdiff;?>"><BR>
<P> total coin: </P>
<input type="text" name="total">
<BR>
</form>
</body>
</html>
可以忽略 php 代码,它正在提取正确的数据,它似乎只是 javascript。