以下のコードをテストしました jQuery UI の datepicker の基本オプション 以下のようなメッセージが出るので、jQuery のコードを一部変更する必要 があるので、ソースでダウンロードして組み込んでいますJavaScript runtime error: Unable to add dynamic content. A script attempted to inject dynamic content, or elements previously modified dynamically, that might be unsafe. For example, using the innerHTML property or the document.write method to add a script element will generate this exception. If the content is safe and from a trusted source, use a method to explicitly manipulate elements and attributes, such as createElement, or use msWWA.execUnsafeLocalFunction.この対処は具体的には以下のようにしていますが、どういう条件で発生する かがまだ不明ではあります。
append: function() { return this.domManip(arguments, true, function( elem ) { if (this.nodeType === 1) { // this.appendChild(elem); var param = this; msWWA.execUnsafeLocalFunction(function () { param.appendChild(elem); }); } }); },
Metro での実行画面![]()
![]()
Metro の HTML
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>jQuery : datepicker</title> <!-- WinJS references --> <link rel="stylesheet" href="/winjs/css/ui-dark.css" /> <script src="/winjs/js/base.js"></script> <script src="/winjs/js/wwaapp.js"></script> <!-- WinWebApp2 references --> <link rel="stylesheet" href="/css/default.css" /> <!-- jQuery references --> <link href="css/jquery-ui-1.8.18.custom.css" rel="stylesheet" type="text/css" /> <script src="js/jquery-1.7.1.js" type="text/javascript"></script> <script src="js/jquery.ui.core.js" type="text/javascript"></script> <script src="js/jquery.ui.datepicker.js" type="text/javascript"></script> <!-- Start --> <script src="/js/default.js"></script> </head> <body style="padding: 100px 0 0 100px;"> <div id="title">ダイアログで決定するとここにセットします</div> <style> .ui-datepicker { width: 250px; z-index:1000!important; } .ui-datepicker-header { padding: 0!important; } </style> Date: <input type="text" id="datepicker" /> <br /> <input type="button" value="dialog" onclick='$( "#datepicker" ).datepicker("dialog","2012/12/31",function(sdate){document.getElementById("title").innerHTML=sdate},datepicker_option);' /> <pre> </pre> </body> </html>
Metro の default.js
(function () { 'use strict'; WinJS.Application.onmainwindowactivated = function (e) { if (e.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) { $(function () { Debug.writeln("jQuery Start"); }); window.datepicker_option = { dateFormat: 'yy/mm/dd', dayNamesMin: ['日', '月', '火', '水', '木', '金', '土'], monthNames: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], showMonthAfterYear: true, yearSuffix: '年', changeYear: true, showAnim: 'fadeIn' } $(function () { $("#datepicker").datepicker(datepicker_option); }); } } WinJS.Application.start(); })();
|
【オワコンの最新記事】
- tiktok > Stable Diffusion : まあ、とにかく凄い今時の頂点系
- Windows 8.1 + Visual Studio 2013 + WebGL + Three.js v65
- Microsoft Visual Studio 2010 のエミュレータは localhost で PC にアクセスできてた。
- Windows Phone で Zune を終了しても実機デバッグはできる( つまり、カメラが使える )
- Windows Phone SDK 8.0 がリリースされました。高橋 忍氏のブログをチェックするといいと思います
- App クラスを介してページ間の参照 / Windows Phone(C#)
- 『Windows8(C#) 2ページテンプレート』で、2ページ目で HttpClient で JSON データをバインドする
- Windows8 の最新版で、C#のテンプレート(Windows ストア)で、ページを追加すると固まるというバグがあるので、テンプレートを作って回避しています。
- 黒子のバスケが始まるまでに Windows Phone の開発環境を作る
- AIR + Papervision3D でメタセコイアの 3D キャラを遊ぶサンプルパッケージ
- Windows8(JavaScript Metro Style 導入) 関連リンク
- Windows 8 Release Preview のコントロールパネルの Flash Player 設定マネージャ
- Windows8 の XMLHttpRequest の POST メソッドのテストの為に、超簡易掲示板を授業中に作成
- AIR+FLARToolkitサンプル開発キット / collada(dae)とメタセコイア(mqo)ローダ実装済
- AIR Flex4 で WEB カメラを最も簡単に実装する方法
- Windows8 + LiveSDK のサンプルコードの実行
- WindowsConsumerPreview やその他の環境で、Microsoft の Live SDK を試す為の情報
- Adobe AIR Flex をだれでも簡単に作成できるパッケージ : ★ 超シンプル FLV プレーヤー ★
- アプリケーションバーを追加する : Win8 Metro(JS)
- Spark のスキンを使った時のウインドウサイズ変更オペレーション : Adobe AIR Flex