0
我正在使用Windows 8 metro應用程序。 在我default.html中的文件我有一個背景圖片:如何在Windows 8中每次點擊更改背景圖片javascript
<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; }
}