home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 September / Chip_2002-09_cd1.bin / tema / neural / webtest / matika / smes / smesi.js < prev    next >
Text File  |  2001-06-23  |  2KB  |  84 lines

  1. var doc=parent.frames[1].document
  2. var frm=parent.frames[2]
  3.  
  4. var T=new Array(["mlΘka","vody","kakaa", "smetany"],
  5.     ["slivovice","lihu","kyseliny","octa"])
  6. var j=new Array(" stup≥∙"," procent")
  7. var o=new Array("o teplot∞","koncentrace")
  8.  
  9. function values(){
  10.  
  11. doc.close()
  12. doc.open()
  13. doc.write('<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1250"><body bgcolor=#fbcf68>')
  14. var frm=parent.frames[2]
  15. frm.nh=0
  16. frm.nv=0
  17.  
  18.  m1 = Math.round(Math.random()*8)+2
  19.  m2 = Math.round(Math.random()*8)+2
  20.  v1 =  (Math.round(Math.random()*6)+1)*(m1+m2)
  21.  v2 =  (Math.round(Math.random()*6)+1)*(m1+m2)
  22.  while (v1==v2){
  23.  v2 =  Math.round(Math.random()*5)*(m1+m2)
  24.  }
  25.  pole=Math.round(Math.random()*1)
  26.  prvek=Math.round(Math.random()*3)
  27.  
  28. m=m1+m2
  29. mv=m1*v1+m2*v2
  30. v=mv/m
  31. frm.m1=m1
  32. frm.m2=m2
  33. frm.v1=v1
  34. frm.v2=v2
  35. frm.v=v
  36. frm.pole=pole
  37.  
  38. doc.write("Kolik "+j[pole]+" bude mφt sm∞s "+m1+" litr∙ "+T[pole][prvek]+" "+
  39.     o[pole]+" "+v1+j[pole]+" a "+
  40.     m2+" litr∙ "+T[pole][prvek]+" "+
  41.     o[pole]+" "+v2+j[pole]+"?")
  42. doc.write("<br>")
  43. doc.write("<hr>")
  44.  
  45. }
  46.  
  47. function hints(){
  48. if (frm.m1 == null) return
  49. frm.nh=frm.nh+1
  50. nh=frm.nh
  51. m12=eval(frm.m1+frm.m2)
  52. if (nh==1){
  53. doc.write("Nßpov∞da: m1="+frm.m1+", v1="+frm.v1+" ; m2="+frm.m2+", v2="+frm.v2+"<br>") 
  54. }
  55. if (nh==2){
  56. doc.write("v = (m1*v1 + m2*v2) / (m1+m2)<br>")
  57. }
  58. if (nh==3){
  59. doc.write("v = ("+frm.m1+"*"+frm.v1+" + "+frm.m2+"*"+frm.v2+") / ("+frm.m1+"+"+frm.m2+")<br>")
  60. }
  61. if (nh==4){
  62. doc.write("v = ("+frm.m1*frm.v1+" + "+frm.m2*frm.v2+") / "+m12+"<br>")
  63. }
  64. if (nh==5){
  65. doc.write("Zkus myslet!<p>")
  66. }
  67. if (nh==6){
  68. doc.write("Nebo aspo≥ poΦφtat. Vφc nßpov∞dy u₧ nenφ!<p>")
  69. }
  70. }
  71.  
  72. function results(){
  73. if (frm.v == null) return
  74. frm.nv=frm.nv+1
  75. nv=frm.nv
  76.  
  77. if (nv==1){
  78. doc.write("<br>V²sledek: v = "+frm.v+" "+j[frm.pole]+".<br>")
  79. doc.write("<hr>")
  80. }else{
  81. }
  82.  
  83. }
  84.