2012-10-06 41 views
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; } 
    } 

回答