consensus_operator.html 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <html>
  2. <head>
  3. <title>Consensus Operator</title>
  4. <script type="text/javascript" src="CertainTrust.js"></script>
  5. <script type="text/javascript" src="certainTrustHTI.js"></script>
  6. <link rel="stylesheet" type="text/css" href="certainTrustHTI.css"/>
  7. <script type="text/javascript" src="certainTrustTViz.js"></script>
  8. <link rel="stylesheet" type="text/css" href="certainTrustTViz.css" />
  9. </head>
  10. <body>
  11. Operand 1 : <br>
  12. <label for="">t1: </label><input type="textbox" name="t1"></input>
  13. <label for="">c1: </label><input type="textbox" name="c1"></input>
  14. <label for="">f1: </label><input type="textbox" name="f1"></input><br><br>
  15. Operand 2 : <br>
  16. <label for="">t2: </label><input type="textbox" name="t2"></input>
  17. <label for="">c2: </label><input type="textbox" name="c2"></input>
  18. <label for="">f2: </label><input type="textbox" name="f2"></input><br><br>
  19. <button onClick="calculateConsensus()">Execute</button><br><br><br>
  20. <div id = "obj1">
  21. </div>
  22. <div id = "obj2">
  23. </div>
  24. <div id = "con">
  25. </div>
  26. <div id = "dis">
  27. </div>
  28. <script type="text/javascript">
  29. function calculateConsensus() {
  30. var t1 = parseFloat(document.getElementsByName('t1')[0].value);
  31. var c1 = parseFloat(document.getElementsByName('c1')[0].value);
  32. var f1 = parseFloat(document.getElementsByName('f1')[0].value);
  33. var t2 = parseFloat(document.getElementsByName('t2')[0].value);
  34. var c2 = parseFloat(document.getElementsByName('c2')[0].value);
  35. var f2 = parseFloat(document.getElementsByName('f2')[0].value);
  36. var ctObject1 = new CertainTrust(t1,c1,f1,50);
  37. var ctObject2 = new CertainTrust(t2,c2,f2,50);
  38. var ctResult1 = ctObject1.CONSENSUS(ctObject2);
  39. var ctResult2 = ctObject1.DISCOUNTING(ctObject2);
  40. document.getElementById("obj1").innerHTML="Operand 1 : ";
  41. var HTI1 = new CertainTrustHTI(ctObject1,{domParent: obj1, canvas:{height: 100, width: 125}, readonly:true});
  42. document.getElementById("obj2").innerHTML="Operand 2 : ";
  43. var HTI2 = new CertainTrustHTI(ctObject2,{domParent: obj2, canvas:{height: 100, width: 125}, readonly:true});
  44. document.getElementById("con").innerHTML="Consensus : ";
  45. var HTI3 = new CertainTrustHTI(ctResult1,{domParent: con, canvas:{height: 100, width: 125}, readonly:true});
  46. document.getElementById("dis").innerHTML="Discounting : ";
  47. var HTI4 = new CertainTrustHTI(ctResult2,{domParent: dis, canvas:{height: 100, width: 125}, readonly:true});
  48. }
  49. </script>
  50. </body>
  51. </html>