旋转器(Spinner) - 货币
本实例是一个捐款表格,带有货币选择和数量旋转器。
源代码
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery UI 旋转器(Spinner) - 货币</title> <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.9.1.js"></script> <script src="http://jqueryui.com/resources/demos/external/jquery.mousewheel.js"></script> <script src="http://jqueryui.com/resources/demos/external/globalize.js"></script> <script src="http://jqueryui.com/resources/demos/external/globalize.culture.de-DE.js"></script> <script src="http://jqueryui.com/resources/demos/external/globalize.culture.ja-JP.js"></script> <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script> <link rel="stylesheet" href="http://jqueryui.com/resources/demos/style.css"> <script> $(function() { $( "#currency" ).change(function() { $( "#spinner" ).spinner( "option", "culture", $( this ).val() ); }); $( "#spinner" ).spinner({ min: 5, max: 2500, step: 25, start: 1000, numberFormat: "C" }); }); </script> </head> <body> <p> <label for="currency">要捐款的货币</label> <select id="currency" name="currency"> <option value="en-US">US $</option> <option value="de-DE">EUR €</option> <option value="ja-JP">YEN ¥</option> </select> </p> <p> <label for="spinner">要捐款的数量:</label> <input id="spinner" name="spinner" value="5"> </p> </body> </html>