| 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta http-equiv="Content-type" content="text/html; charset=utf-8"/> |
| 5 | <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/> |
| 6 | <meta name="apple-mobile-web-app-capable" content="yes"/> |
| 7 | <title>Rating</title> |
| 8 | |
| 9 | <script type="text/javascript" src="../deviceTheme.js" data-dojo-config="mblThemeFiles: ['base'],mblUserAgent:'iPhone'"></script> |
| 10 | <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="async: true, parseOnLoad: true"></script> |
| 11 | |
| 12 | <script type="text/javascript"> |
| 13 | var val = 0; |
| 14 | require([ |
| 15 | "dijit/registry", |
| 16 | "dojox/mobile/parser", |
| 17 | "dojox/mobile", |
| 18 | "dojox/mobile/compat", |
| 19 | "dojox/mobile/Rating" |
| 20 | ], function(registry){ |
| 21 | increment = function(){ |
| 22 | if(val == 7){ return; } |
| 23 | val += 0.5; |
| 24 | registry.byId("star").set("value", val); |
| 25 | document.getElementById("value").innerHTML = val; |
| 26 | }; |
| 27 | decrement = function(){ |
| 28 | if(val == 0){ return; } |
| 29 | val -= 0.5; |
| 30 | registry.byId("star").set("value", val); |
| 31 | document.getElementById("value").innerHTML = val; |
| 32 | }; |
| 33 | }); |
| 34 | </script> |
| 35 | <style> |
| 36 | button { |
| 37 | width: 100px; |
| 38 | } |
| 39 | </style> |
| 40 | </head> |
| 41 | <body style="visibility:hidden;"> |
| 42 | <span id="star" data-dojo-type="dojox.mobile.Rating" data-dojo-props='image:"images/star-orange.png",numStars:7'></span> |
| 43 | <span id="value">0</span><br> |
| 44 | <button type="button" onclick="decrement()">−</button> |
| 45 | <button type="button" onclick="increment()">+</button> |
| 46 | </body> |
| 47 | </html> |