sample_rating.html 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <link rel="stylesheet" href="../../../themes/themeroller/maemo5-theme/ui.all.css" type="text/css" media="screen" />
  5. <link rel="stylesheet" href="../../../themes/nokia/ext-theme/maemo5/800x480/custom.css" type="text/css" media="screen" />
  6. <script src="../../../lib/jquery/jquery.js" type="text/javascript" charset="utf-8"></script>
  7. <script src="../../../src/defaults.js" type="text/javascript" charset="utf-8"></script>
  8. <script src="../../../src/core.js" type="text/javascript" charset="utf-8"></script>
  9. <style type="text/css" media="screen">
  10. body {
  11. font-size: 14px;
  12. padding: 15px;
  13. font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif";
  14. }
  15. p {
  16. margin: 30px 10px;
  17. }
  18. </style>
  19. </head>
  20. <body>
  21. <div id="rating01"></div>
  22. <br style="clear: both;" />
  23. <br style="clear: both;" />
  24. <button onclick="window.rating1.setValue(0);">clear</button>
  25. <button onclick="window.rating1.setValue(3);">set value to 3</button>
  26. <button onclick="window.rating1.setValue(5);">set value to 5</button>
  27. <br /><br />
  28. <button onclick="alert(window.rating1.getValue());">get value</button>
  29. <br /><br />
  30. <span>Readonly Rating</span>
  31. <div id="rating02"></div>
  32. <br style="clear: both;" />
  33. <br style="clear: both;" />
  34. <button onclick="window.rating2.setValue(0);">clear</button>
  35. <button onclick="window.rating2.setValue(3);">set value to 3</button>
  36. <button onclick="window.rating2.setValue(5);">set value to 5</button>
  37. <br /><br />
  38. <button onclick="alert(window.rating2.getValue());">get value</button>
  39. <script type="text/javascript" charset="utf-8">
  40. var init = function() {
  41. window.rating1 = new Nokia.Rating({
  42. element: '#rating01',
  43. value: 2,
  44. create: function() {
  45. console.log("Rating: Create.");
  46. },
  47. change: function(event, value) {
  48. console.log("Rating: Change - " + value);
  49. }
  50. });
  51. window.rating2 = new Nokia.Rating({
  52. element: '#rating02',
  53. value: 3,
  54. readonly: true
  55. });
  56. /*
  57. * Hide splash when its all done.
  58. */
  59. Nokia.hideSplash();
  60. };
  61. /*
  62. * Show splash while loading components.
  63. */
  64. Nokia.showSplash('<span>loading</span>');
  65. Nokia.use('rating', init);
  66. </script>
  67. </body>
  68. </html>