daily pastebin goal
52%
SHARE
TWEET

Untitled

a guest Nov 16th, 2017 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2. var thoudelim = ",";
  3.  var decdelim = ".";
  4.  var curr = " ";
  5.  var d=document;
  6.  
  7.  function haltnondigit(e) {
  8.   var allowkey=Array(48,49,50,51,52,53,54,55,56,57,8,9,188,190,45,46,13,33,34,35,36,37,38,39,40,112,113,114,115,116,117,118,119,120,121,123);
  9.   if(allowkey.indexOf(e.keyCode)==-1) return false;
  10.   return true;
  11.  }
  12.  function format(s,r) {
  13.   s=Math.round(s*Math.pow(10,r))/Math.pow(10,r);
  14.   s=String(s);s=s.split(".");var l=s[0].length;var t="";var c=0;
  15.   while(l>0){t=s[0][l-1]+(c%3==0&&c!=0?thoudelim:"")+t;l--;c++;}
  16.   s[1]=s[1]==undefined?"0":s[1];
  17.   for(i=s[1].length;i<r;i++) {s[1]+="0";}
  18.   return curr+t+decdelim+s[1];
  19.  }
  20.  function input_keyup(t) {
  21.   t.value=t.getAttribute('ref');t.select();
  22.  }
  23.  function input_keyup(t,e) {
  24.   return haltnondigit(e);t.value=t.getAttribute('ref');
  25.  }
  26.  function input_keyup(t,s) {
  27.   t.setAttribute('ref',t.value);
  28.   if(s=="qty") {
  29.    var temp=parseFloat(t.parentNode.nextSibling.firstChild.getAttribute('ref'))*t.value;
  30.    t.parentNode.nextSibling.nextSibling.firstChild.setAttribute('ref',temp);
  31.    t.parentNode.nextSibling.nextSibling.firstChild.innerHTML=format(temp,2);
  32.   }
  33.   else if(s=="harga") {
  34.    var temp=parseFloat(t.parentNode.previousSibling.firstChild.getAttribute('ref'))*t.value;
  35.    t.parentNode.nextSibling.firstChild.setAttribute('ref',temp);
  36.    t.parentNode.nextSibling.firstChild.innerHTML=format(temp,2);
  37.   }
  38.   calc_total();
  39.  }
  40.  function input_keyup(t) {
  41.   t.value=format(t.value,2);
  42.   return false;
  43.  }
  44.  function calc_total() {
  45.   var x=d.getElementsByTagName("DIV");
  46.   var total=0;
  47.   for(i=0;i<x.length;i++) {
  48.    if(x[i].id=="subtotal") total+=isNaN(parseFloat(x[i].getAttribute("ref")))?0:parseFloat(x[i].getAttribute("ref"));
  49.   }
  50.   d.getElementById("total").innerHTML=format(total,2);
  51.  }
  52. function MM_openBrWindow(theURL,winName,features) { //v2.0
  53.   window.open(theURL,winName,features);
  54. }
  55. </script>
  56.  
  57. </head>
  58.  
  59. <body>
  60. <form id="form1" name="form1" method="post" action="<?php echo $editFormAction; ?>" >
  61.   <table width="832" border="1" cellspacing="0" cellpadding="0">
  62.       <tr>
  63.         <td>MATERIAL</td>
  64.         <td>QTY</td>
  65.         <td>HARGA</td>
  66.         <td>JUMLAH</td>
  67.       </tr>
  68.       <tr>
  69.       <td><label for="material"></label>
  70.       <input type="text" name="material" id="material" />
  71.       <input name="help" type="button" id="help" onclick="MM_openBrWindow('window/test window harga.php','','scrollbars=yes,width=700,height=500')" value="Help" /></td>
  72.       <td><input type="text" id="qty" name="qty[]" value="0"
  73.     rel="0"
  74.     ref="0"
  75.     onkeyup="input_keyup(event,this,'qty');"
  76.     >
  77.     </td><td><input type="text" id="harga" name="harga[]" value="0"
  78.     rel="0"
  79.     ref="0"
  80.     onkeyup="input_keyup(event,this,'harga');"
  81.     >
  82.     </td><td><div id="subtotal" align="right" ref="0">0.00</div></td>
  83.     </tr>
  84.     <tr>
  85.       <td>&nbsp;</td>
  86.       <td>&nbsp;</td>
  87.       <td id="price" >&nbsp;</td>
  88.       <td>&nbsp;</td>
  89.     </tr>
  90.     <tr>
  91.       <td colspan="4"><div align="center">
  92.         <input type="submit" name="submit" id="submit" onclick="return tanya()" value="Submit" />
  93.         <input type="reset" name="reset" id="reset" value="Reset" />
  94.       </div></td>
  95.     </tr>
  96.   </table>
  97.   <input type="hidden" name="MM_insert" value="form1" />
  98.   <script>
  99.  calc_total();
  100. </script>
  101.  
  102. </form>
  103. </body>
  104. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top