locked
winjs: unexpected string is shown automatically, while displays pages? RRS feed

  • Question

  • Everything is fine for the below code. But, if i run as per the below code, while showing the output, `[object Object]` is displayed automatically. I don't know why



     
     function buttonClick() 
        {
        var getFile = parseInt(document.getElementById("number").value);
        if (getFile < 455 && getFile > 0)
        {
            var content = document.getElementById("def-content");
            var output = new WinJS.UI.HtmlControl(content, { uri: '/def/f' + getFile + '.html' });
            content.innerText = output;
         }
         else
         {
         var fails = new Windows.UI.Popups.MessageDialog("Expected Input Range: 1 to 454");
         fails.showAsync();
          }
          }


    - Mohamed Thaufeeq A

    Thursday, August 22, 2013 10:25 AM

Answers

  • This is an answer. Thanks for all.

    function buttonClick() 
        {
        var getFile = parseInt(document.getElementById("number").value);
        if (getFile < 455 && getFile > 0)
        {
            var content = document.getElementById("def-content");
            var output = new WinJS.UI.HtmlControl(content, { uri: '/def/f' + getFile + '.html' });
            content.innerText = "";
         }
         else
         {
         var fails = new Windows.UI.Popups.MessageDialog("Expected Input Range: 1 to 454");
         fails.showAsync();
          }
          }


    - Mohamed Thaufeeq A

    Friday, August 23, 2013 10:29 AM

All replies

  • Hi Mohamed,

    Your output is a object, that's why your content shows [object Object].

    Base on the document, I think you could do something like below to fix your issue:

    function buttonClick() 
        {
        var getFile = parseInt(document.getElementById("number").value);
        if (getFile < 455 && getFile > 0)
        {
            var content = document.getElementById("def-content");
            var output = new WinJS.UI.HtmlControl(content, { uri: '/def/f' + getFile + '.html' });
            WinJS.UI.processAll();
         }
         else
         {
         var fails = new Windows.UI.Popups.MessageDialog("Expected Input Range: 1 to 454");
         fails.showAsync();
          }

    Best Regards,

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Friday, August 23, 2013 1:15 AM
    Moderator
  • This is an answer. Thanks for all.

    function buttonClick() 
        {
        var getFile = parseInt(document.getElementById("number").value);
        if (getFile < 455 && getFile > 0)
        {
            var content = document.getElementById("def-content");
            var output = new WinJS.UI.HtmlControl(content, { uri: '/def/f' + getFile + '.html' });
            content.innerText = "";
         }
         else
         {
         var fails = new Windows.UI.Popups.MessageDialog("Expected Input Range: 1 to 454");
         fails.showAsync();
          }
          }


    - Mohamed Thaufeeq A

    Friday, August 23, 2013 10:29 AM