Advertisement
conception

Chinese.js

Oct 11th, 2015
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. window.onload = function(){
  2. var appName = navigator.appName;
  3. var appVersion = navigator.appVersion;
  4. var msg = "Web Browser is " + appName + "\nWeb Browser Version is " + appVersion;
  5. alert(msg);
  6. };
  7.  
  8. var itemTotal;
  9. var items = document.getElementsByTagName("input");
  10. document.getElementById("submit").addEventListener("click",calcTotal,false);
  11.  
  12. function calcTotal() {
  13. var bullets = [];
  14. itemTotal = 0;
  15.  
  16. for(var i=0;i<9;i++){
  17. if ( items[i].checked ) {
  18. itemTotal += (items[i].value * 1);
  19. bullets.push(items[i].name + " $" + items[i].value);
  20. }
  21.  
  22. }
  23. totalCost = itemTotal.toFixed(2);
  24. foodWin = window.open("about:blank", "chinesefood", "width=320, height=240");
  25.  
  26. foodWin.document.write("<h2>Your Chinese Food Order</h2>");
  27.  
  28. foodWin.document.write("<ul>");
  29. for (var i = 0; i < bullets.length; i++){
  30. foodWin.document.write("<li>" + bullets[i] + "</li>");
  31. }
  32. foodWin.document.write("</ul>");
  33.  
  34. foodWin.document.write("<br/>Total Order is $" + totalCost);
  35. setTimeout("foodWin.close()", 10000);
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement