0

我正在开发一个 Windows 8 Metro 应用程序。在我的 default.html 文件中,我有一个背景图片:

<div id="backgroundImage" >
        <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
            <defs>
                <filter id="myGaussianBlur" x="0" y="0">
                    <feGaussianBlur in="SourceGraphic" stdDeviation="2"></feGaussianBlur>
                </filter>
            </defs>
            <image xlink:href="**surf.jpg**" width="100%" height="100%" preserveAspectRatio="none" filter="url(#myGaussianBlur)" />
        </svg>
    </div>

我想替换href="surf.jpg"参考。我还有一个文件,Creator.js,它包含当前图像:

 var ControlConstructor = WinJS.UI.Pages.define("Creator.html", {
    // This function is called whenever a user navigates to this page. It
    // populates the page elements with the app's data.
    ready: function (element, options) {
        // TODO: Initialize the page here.

        // the options of the Creator are: image.
        // image is the path to the boleh creator's background image.
        options = options || {};
        this._data = WinJS.Binding.as({ image: options.image });

我还有一个 getter 和一个 setter:

 // Getters/setters for image


   image: {
        get: function () { return this._data.image; },
        set: function (value) { this._data.image = value; }
    }
4

1 回答 1

0

我在尝试开发应用程序时发现有使用 JavaScript 编写代码的博客阅读器.....我正在分享链接,您可以检查它是否对您有任何帮助。

http://msdn.microsoft.com/en-us/library/windows/apps/hh974582.aspx

您还可以查看 Codeproject 中的简单文章.....这也可以帮助您 http://www.codeproject.com/Articles/338916/Windows-8-JavaScript-Metro-Application-Getting-Sta

于 2012-10-06T16:31:48.703 回答