home *** CD-ROM | disk | FTP | other *** search
/ 11 Top Anwendungen / CD_ROM_MAGAZIN.iso / MoneyMethod-Demo / Beispiel / source / scripts / xslcheck.js < prev   
Encoding:
Text File  |  2000-05-29  |  2.6 KB  |  88 lines

  1.  
  2. var isIE = false;
  3. var comp = navigator.appName;
  4. if (comp.indexOf("Microsoft") >= 0) {
  5.     isIE = true;
  6. }
  7.  
  8. // test function for debugging internals
  9. function test()
  10. {
  11.  var s = "";
  12.  
  13.  for(var i = 1; i <= parent.shop.orderNum; i++)
  14.     s += parent.shop.orderList[i].anzahl + " x " + parent.shop.orderList[i].name + "\n";
  15.  
  16.  alert("DataBase Input:\n" + s);
  17. }
  18.  
  19. function MyEval(form, str) {
  20.      //alert(form.name +"."+ str);
  21.         if (isIE) {
  22.                return eval(form.name +"."+ str);
  23.         }
  24.         else {
  25.                return form.eval(str);
  26.         }
  27. }
  28.  
  29. function ChangeTxt(form, form1) {
  30.     var x, h;
  31.  
  32. var str="quantity"; // as the edit box name
  33. var num=form.name.substring(str.length, form.name.length); // got the row number
  34.  
  35.     h = "num" + num + ".value"; // numX.value
  36.     // num - MAX quantity of available items
  37.     n  = parseInt(MyEval(form1, h));
  38.     nv = parseInt(form.value);
  39.  
  40.     if (form.value != "" && form.value != "0" && !isNaN(nv))
  41.          {
  42.             if (nv < 0) {
  43.                 alert("Negotive value!!!");
  44.                 form.value = 1;
  45.                 form.select();
  46.                 form.focus();
  47.                 return false;
  48.             }
  49.  
  50.             if (nv > n) {
  51.         message = "Die maximale Bestellmenge eines Artikels: " + n ;
  52.                 alert(message);
  53.                 form.value = MyEval(form1, h);
  54.                 form.select();
  55.                 form.focus();
  56.                 return false;
  57.             }
  58.  
  59.             n = form.value;
  60.  
  61.             isbn  = MyEval(form1, "isbn" + num + ".value");
  62.             title = MyEval(form1, "title" + num + ".value");
  63.             price = MyEval(form1, "price" + num + ".value");
  64.             link  = MyEval(form1, "link" + num + ".value");
  65.             maxitem = MyEval(form1, "num" + num + ".value");
  66.             index = MyEval(form1, "index" + num + ".value");
  67.  
  68.             parent.shop.addOrderElem(n, title, isbn, price, link, maxitem, index);
  69.     }
  70.     else {
  71.         n=0;
  72.         form.value = "";
  73.             isbn  = MyEval(form1, "isbn" + num + ".value");
  74.             title = MyEval(form1, "title" + num + ".value");
  75.             price = MyEval(form1, "price" + num + ".value");
  76.             link  = MyEval(form1, "link" + num + ".value");
  77.             maxitem = MyEval(form1, "num" + num + ".value");
  78.             index = MyEval(form1, "index" + num + ".value");
  79.  
  80.            parent.shop.addOrderElem(-n, title, isbn, price, link, maxitem, index);
  81.         // remove this order string from list
  82.  
  83.     }
  84.     return true;
  85. }
  86. // end of checks.js
  87.  
  88.