java - JavaFX: Our javascript file is not working when we build the html and put the link in header. Why is this? -
the user should able change value , numbers should change. wrong in situation? possible link js file in html run in javafx webview?
var numberstochange; var multiplier; function pageload() { var inputbox = number(document.getelementbyid("servinginputbox").value); multiplier = new array(); numberstochange = document.getelementsbyclassname("numbertochange"); (i = 0; < numberstochange.length; i++) { multiplier[i] = number(numberstochange[i].innerhtml) / inputbox; } } function changenumbers() { var inputboxvalue = number(document.getelementbyid("servinginputbox").value); (i = 0; < numberstochange.length; i++) { numberstochange[i].innerhtml = (math.trunc((inputboxvalue * multiplier[i]) * 10)) / 10; } } function increase() { var inputbox = number(document.getelementbyid("servinginputbox").value); document.getelementbyid("servinginputbox").value = (math.trunc(inputbox * 10) + 10) / 10; changenumbers(); } function decrease() { var inputbox = number(document.getelementbyid("servinginputbox").value); var newnumber = (math.trunc(inputbox * 10) - 10) / 10; if (newnumber >= 0) { document.getelementbyid("servinginputbox").value = newnumber; changenumbers(); } } function enter(e) { if (e.keycode == 13) { var inputbox = number(document.getelementbyid("servinginputbox").value); document.getelementbyid("servinginputbox").value = math.trunc(inputbox * 10) / 10; changenumbers(); } }
@font-face { font-family: 'archivo black'; font-style: normal; font-weight: 400; src: local('archivo black regular'), local('archivoblack-regular'), url(http://fonts.gstatic.com/s/archivoblack/v4/woaovt7k3k7hhfxkbvb6b6gwzwavuvwqyndpq0vh9ho.woff2) format('woff2'), url(http://fonts.gstatic.com/s/archivoblack/v4/woaovt7k3k7hhfxkbvb6b0btupgxyev-vbvv8kqqzri.woff) format('woff'); } html,body{ margin:0 0 1px; padding:0 } input,textarea{ background-color:white } html{ overflow-y:scroll; height:100% } body{ font-family:'open sans',sans-serif; font-size:11px; color:#202020; line-height:14px; position:relative; padding-bottom:50px; background-repeat:repeat-x; background-position:0 -298px; background-color:white } .nutritionlabel{ font-size:115% !important } @import url("//fonts.googleapis.com/css?family=archivo+black"); .nutritionlabel input.unitquantitybox.ui-shadow-inset{ box-shadow:none } .nutritionlabel{ font-size:90%; margin-bottom:1.1em; padding:.68em; color:#333; font-family:arial,helvetica,sans-serif; border:2px solid #000; line-height:normal } .nutritionlabel .title{ line-height:.83em; font-size:2.7em; padding-bottom:4px; font-family:'archivo black'; white-space:nowrap; letter-spacing:-2px } .nutritionlabel .m{ font-size:.9em } .nutritionlabel .serving{ font-size:1.1em; line-height:1.28em; padding-bottom:2px } .nutritionlabel .name{ font-size:1.1em; line-height:1.3em } .nutritionlabel .name.inline{ padding-top:.2em; padding-top:.25em \9 } .nutritionlabel .dvcaloriediet,.nutritionlabel #calcdisclaimer{ font-size:.9em } .nutritionlabel .line{ border-top:1px solid #333; padding:1px 0 } .nutritionlabel .line.last{ border-bottom:1px solid #333 } .nutritionlabel .line.indent{ margin-left:15px } .nutritionlabel .dv{ float:right } .nutritionlabel .dv:before{ content:'\0000a0' } .nutritionlabel .bar1{ height:10px; line-height:0; font-size:1px; background:#333 } .nutritionlabel .bar2{ height:5px; line-height:0; font-size:1px; background:#333 } .nutritionlabel .dvcaloriediet{ color:#777 } .nutritionlabel .calorienote{ padding:.60em 0 0 .70em } .nutritionlabel .star{ margin-left:-7px } .nutritionlabel .tblcaloriediet th{ font-size:.7em; border-bottom:1px solid #333; text-align:left; color:#777 } .nutritionlabel .tblcaloriediet{ width:100% } .nutritionlabel .tblcaloriediet td{ padding:0; line-height:normal; font-size:.7em; color:#777 } .nutritionlabel .ar{ text-align:right } .nutritionlabel .fr{ float:right } .nutritionlabel .fl{ float:left } .nutritionlabel #calcdisclaimer{ color:#777 } .nutritionlabel .spaceabove{ height:10px } .nutritionlabel .setter{ width:12px; padding:3px 0 0 0; position:absolute; left:0; top:0; z-index:100 } .nutritionlabel .setter a{ display:block; width:9px; height:7px; font-size:1px; line-height:0em } .nutritionlabel a.unitquantityup{ padding-bottom:1px; background:transparent url("up.png") left top no-repeat; z-index:9999 } .nutritionlabel a.unitquantitydown{ padding-top:1px; background:transparent url("down.png") left bottom no-repeat; z-index:9999 } .nutritionlabel input.unitquantitybox{ width:25px; height:22px; padding:2px; font-size:.9em !important; margin-left:15px; margin-bottom:0; line-height:15px \9 } .nutritionlabel input.unitquantitybox.arrowsarehidden{ margin-left:0 } .nutritionlabel .rel{ position:relative } .nutritionlabel .servingsizefield{ float:left; margin-top:.2em; margin-bottom:.2em; margin-right:.4em } .nutritionlabel .servingunit{ float:left; padding:0; margin-top:.3em; margin-bottom:.2em } .nutritionlabel .servingweightgrams{ padding:0 0 0 .3em; margin-top:.3em; margin-bottom:.2em } .nutritionlabel .servingsizetext{ padding-right:.3em; margin-top:.3em } .nutritionlabel .servingunitquantity{ margin-top:.3em; padding-right:.3em } .cf:before,.cf:after{ content:" "; display:table } .cf:after{ clear:both } .cf{ *zoom:1 } .nutritionlabel .servingsizetext{ display:inline-block } .nutritionlabel .line{ line-height:normal; } .nutritionlabel .title{ padding-bottom:6px; }
<html> <head> </head> <body onload="pageload()"> <div class="nutritionlabel" style="width: 283px;"> <div class="title">nutrition facts</div> <div class="name">ice cream</div> <div class="serving"> <div class="cf"> <div class="servingsizetext fl">serving size:</div> <div class="rel servingsizefield fl"> <div class="setter"> <a href="javascript:increase()" class="unitquantityup" rel="nofollow"></a> <a href="javascript:decrease()" class="unitquantitydown" rel="nofollow"></a> </div> <input value="1" id="servinginputbox" class="unitquantitybox" type="text" onkeypress="enter(event)"> </div> <div class="servingunit fl unithastextbox">pizza</div> <div class="servingweightgrams fl gramshastextbox">(853g)</div> </div> </div> <div class="bar1"></div> <div class="line m"><b>amount per serving</b> </div> <div class="line"> <div class="fr">calories fat <span class="numbertochange">740</span> </div> <div><b>calories</b> <span class="numbertochange">2270</span> </div> </div> <div class="bar2"></div> <div class="line ar"><b>% daily value<sup>*</sup></b> </div> <div class="line"> <div class="dv"><b><span class="numbertochange">128</span></b>%</div><b>total fat</b><span class="numbertochange"> 83</span>g</div> <div class="line indent"> <div class="dv"><b><span class="numbertochange">190</span></b>%</div>saturated fat<span class="numbertochange"> 83</span>g</div> <div class="dvcaloriediet line"> <div class="calorienote"><span class="star">*</span>percent daily values based on 2000 calorie diet.</div> </div> </div> </body> </html>
please if have knowledge on issue.
please include javascript file in head. css not load suppose. structure of head follows.
<head> <meta charset="utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <title>abc</title> <link rel="stylesheet" href="style/app.css"/> <script src="js/app.js"></script></head>
also, parallel path of html file, create folders 'style' , 'js' , insert js , css files in folders names 'app.css' , 'app.js' should job.
Comments
Post a Comment