De følgende demo samples viser dig hvordan man opretter en singleton i javascript og hvordan man kan kode en dato formatter og formatere et beløb med det locale der er gældende for dit område
Denne kode viser dig, hvordan du kan inkludere javascript som ASP filer C# and .NET framework
Eksemplet viser hvordan man ved hjælp af javascript og ASP inklude filer med .NET framework og C# kan formatere et beløb og en dato
<% '/** ' * Test of the *.js ' * @package javascript ' * @filesource ' * @see index.php ' * @copyright (c) http://Finn-Rasmussen.com ' * @license http://Finn-Rasmussen.com/license/ myPHP License conditions ' * @author http://Finn-Rasmussen.com ' * @version 1.11 ' * @since 27-nov-2009 ' */ %> <html> <head> <title>Test of ASP and .NET and C# javascript include files</title> <script type="text/javascript"> <% '// First you must include the js - jsp files to use %> <!-- #include file="CountryCode.js.asp" --> <!-- #include file="LanguageCode.js.asp" --> <!-- #include file="Locale.js.asp" --> <!-- #include file="DateFormat.js.asp" --> <!-- #include file="Amount.js.asp" --> <!-- #include file="AmountFormat.js.asp" --> <!-- #include file="Request.js.asp" --> <% '// Get the current Locale dim language dim country language = "da" ' Danish country = "DK" ' Denmark %> var thisLocale = Locale.getInstance('<%=language%>', '<%=country%>'); </script> </head> <body> <h4>Test of javascript date and amount formatters with asp include</h4> <p>This demo file will show you have to use the javascript asp include files</p> <p>First you have to include the javascript js.asp files, like this:</p> <ul><li><script type="text/javascript" src="/myphp-1.11/myphp-1.11-js/html/asp/CountryCode.js.asp"></script> </li></ul> <p>Then you must create the form elements like this:</p> <ul><li><input type="text" name="date[0]" value="$date0" size="10" maxlength="10" onblur="this.value=DateFormat.format(this.value)" /></li></ul> <% '// Test data dim date0 dim date1 dim date2 dim date3 dim amount0 dim amount1 dim amount2 dim amount3