locked
Events registered

    Question

  • I  registered a event  in "page.js".

    demo  is below:

     ui.Pages.define("/html/Page2.html", {
    
            ready: function (element, options) {
                var h = document.getElementsByClassName("ReadPage_AppBar_Bottom")[0];
                h.disabled = false;
    
                var slider = document.getElementById("ReadPage_Slider_PagePercent");
                //var backbutton=document.getElementsByClassName("win-backbutton")[0];     
                var pagePercent = slider.value;
                document.getElementsByClassName("ReadPage_Text_AppbarSliderPercent")[0].textContent = "第" + pagePercent + "页";
                var a=slider.addEventListener("change", this.sliderChangeValue, false);
                //backbutton.addEventListener("click",this.backbuttonChangeValue,false)
            },
    
            sliderChangeValue: function (event) {
                document.getElementsByClassName("ReadPage_Text_AppbarSliderPercent")[0].textContent = "第" + event.srcElement.value + "页";
            },

    if  I  click backbutton,  how much the event  is  registered ,and reason ?
    Saturday, April 28, 2012 5:54 AM

Answers

  • I don't entirely follow your question, but let me take a guess that you're wondering what the backbutton event handler needs to do.

    That is, when you register for "click," your backButtonChangeValue will be called. In that handler, if you want to navigate to the previous page, then it needs to call WinJS.Navigation.back(). This function then raises some navigation events that are picked up by the PageControlNavigator object that should be in navigator.js of your project (this is included in most of the templates). In response, the PageControlNavigator will take whatever page is in the backstack and load it into the DOM.

    If that's not what you're looking for, please explain more specifically.

    .Kraig

    Monday, April 30, 2012 2:57 AM