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