UNPKG

dojox

Version:

Dojo eXtensions, a rollup of many useful sub-projects and varying states of maturity – from very stable and robust, to alpha and experimental. See individual projects contain README files for details.

48 lines (45 loc) 1.5 kB
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8"/> <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/> <meta name="apple-mobile-web-app-capable" content="yes"/> <title>Rating</title> <script type="text/javascript" src="../deviceTheme.js" data-dojo-config="mblThemeFiles: ['base'],mblUserAgent:'iPhone'"></script> <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="async: true, parseOnLoad: true"></script> <script type="text/javascript"> var val = 0; require([ "dijit/registry", "dojox/mobile/parser", "dojox/mobile", "dojox/mobile/compat", "dojox/mobile/Rating" ], function(registry){ increment = function(){ if(val == 7){ return; } val += 0.5; registry.byId("star").set("value", val); document.getElementById("value").innerHTML = val; }; decrement = function(){ if(val == 0){ return; } val -= 0.5; registry.byId("star").set("value", val); document.getElementById("value").innerHTML = val; }; }); </script> <style> button { width: 100px; } </style> </head> <body style="visibility:hidden;"> <span id="star" data-dojo-type="dojox.mobile.Rating" data-dojo-props='image:"images/star-orange.png",numStars:7'></span> <span id="value">0</span><br> <button type="button" onclick="decrement()">&minus;</button> <button type="button" onclick="increment()">+</button> </body> </html>