javascript - Accept user input and multiply by 0.00000116414, copy results to clipboard -
this code pops asking users input, , multiplies 0.00000116414.
i want change text input field , calc button, perhaps add ability copy clipboard. how might this?
<html> <head> <meta name="recommended share difficulty calculator" content="[share dicciculty calculator]" /> <title>recommended share difficulty</title> <script type="text/javascript"> function maththing() { input = prompt("enter max kh/s.", ""); if (input==null || input=="") { return false; } share = 0.00000116414 ; total = input * share; alert(input + " * " + share + " = " + total); } </script> </head> <body> <a href="javascript:maththing()">calculate</a> </body> </html>
in order manipulate contents of users clipboard need utilize flash. there great helper library called zeroclipboard. i've set basic demo (that uses javascript) uses javascript:
var client = new zeroclipboard( $("#copy"), { moviepath: "http://zeroclipboard.org/javascripts/zc/zeroclipboard_1.3.2.swf" }); client.on('datarequested', function (client, args) { client.settext((function () { input = prompt("enter max kh/s.", ""); if (input == null || input == "") { return; } share = 0.00000116414; total = input * share; alert('"'+input + " * " + share + " = " + total+'" copied clipboard'); return input + " * " + share + " = " + total; })()); });
this code follows examples provided in 0 clipboard, odd thing doesn't seem work 100% of time. of work on computers don't have flash don't know if reliability part of library or computer. luck.
Comments
Post a Comment