web3.js/index.html

41 lines
1.0 KiB
HTML
Raw Normal View History

2014-09-30 20:51:53 +00:00
<!doctype>
<html>
<head>
2014-11-03 16:46:56 +00:00
<script type="text/javascript" src="es6-promise-2.0.0.js"></script>
<script type="text/javascript" src="main.js"></script>
<script type="text/javascript" src="websocket.js"></script>
<script type="text/javascript" src="qt.js"></script>
2014-10-28 15:53:31 +00:00
<script type="text/javascript" src="httprpc.js"></script>
2014-09-30 20:51:53 +00:00
<script type="text/javascript">
2014-11-03 16:46:56 +00:00
if (window.Promise === undefined) {
window.Promise = ES6Promise.Promise;
}
//web3.setProvider(new web3.providers.QtProvider());
web3.setProvider(new web3.providers.HttpRpcProvider("http://localhost:8080"));
function testSnippet() {
web3.eth.watch({altered: web3.eth.coinbase}).changed(function() {
web3.eth.balanceAt(web3.eth.coinbase).then(function (balance) {
document.getElementById("result").innerText = web3.toDecimal(balance);
});
2014-09-30 20:51:53 +00:00
});
}
2014-11-03 16:46:56 +00:00
2014-09-30 20:51:53 +00:00
</script>
</head>
<body>
<h1>std::name_reg</h1>
<input type="text" id="name"></input>
2014-11-03 16:46:56 +00:00
<button type="button" onClick="testSnippet();">test snippet</button>
<div></div>
result: <div id="result"></div>
2014-09-30 20:51:53 +00:00
</body>
</html>