Menu

linknx and html

Help
kervy
2009-01-26
2012-12-14
  • kervy

    kervy - 2009-01-26

    I want since my page html to send <Read> <object id='ecl_wc '/> </read>, by clicking on the button " Sub-category 1 " (left 1)

    <html>
    <head>
    <title>Page Title</title>

    <link rel="STYLESHEET" type="text/css" href="Main.css">

    <script src="BasicFunctions.js" type="text/javascript"></script>
    <script src="Scrolling.js" type="text/javascript"></script>
    <script src="MoveFocus.js" type="text/javascript"></script>
    <script>
        function pageLoadFunctions()
        {
            setBGColor("#666666");
            checkSVP();
            setCounter();
            setArray();
            startFocus()
        }

        // -----------------------------------------------------------------
        // Open a 2ft window on Harmony and MCE emulator environments
        //
        function launch2ft( page )
        {
            var okStop = NAP_Dialog( "You will need to go to your PC to complete this process. A window will now be opened on your PC.\n\nContinue?", "NOTICE", 12, 60, true );
            if ( okStop != 2 )
                return XS_CANCEL;
            page = "launchHTML=" + URLEncode( page );
            showModelessDialog("reg_launch2ft.html?" + page,window,"status:false;dialogWidth:300px;dialogHeight:30px");
        }

        // -----------------------------------------------------------------
        // Generic routine used to open a 2ft window. This function supports
        // Symphonony, Harmony, MCX devices and MCE emulators
        //
        function goToURL2ft( name, URL )
        {
            try
            {
                // this function gives console users three options:
                // 1. Open an IE window and go to the assigned URL
                // 2. Create a shortcut on their desktop to the URL
                // 3. Cancel
                // bobsled users don't get option #1

                // params are str shortcut title, str URL
                window.external.MediaCenter.CreateDesktopShortcut(name, URL)
            }
            catch(e)
            {
                launch2ft( URL );
            }
        }

         function doSelect()
        {
        /* This function determines what your buttons do when they are selected
        (navigate, call a function, etc.). This function will get called whenever user
        clicks a focusable item, or selects it with "OK" button on remote. Make sure to
        include a case below for each focusable item on the page */
            switch(oCurFocus.id)
            {
                case "Left1": // ID of button
                {

                    break;
                }
                case "Left2":  // ID of button
                {
                    // assign button functionality statements here
                    break;
                }
                case "Left3":  // ID of button
                {
                    // assign button functionality statements here
                    break;
                }
                // .. and so on. Create a case for each button on the page.
            }
        }
    </script>

    </head>

    <body id="body" MCFocusStart="Left4" onload="pageLoadFunctions()" onkeydown="onRemoteEvent(window.event.keyCode)">
    <A id=install href="http://sms.napster.com/client/plugin/wmp10/not_installed.html?ehome=1"></A>
    <!-- Start span used as stand-in for Shared Viewport -->
    <span style="position: absolute; top: 0; left: 0; height: 100%;">
        <table style="position: absolute; top: 0; left: 0; height: 100%;" cellspacing="0" cellpadding="0">
        <tr><td valign="bottom" height="100%">
            <span id="SVP" style="width: 308; height: 216; vertical-align: bottom" MCFocusable="true"></span>
        </td></tr>
        </table>
    </span>
    <!-- End span used as stand-in for Shared Viewport -->

    <!-- Headline -->
    <span class="text1" style="position: absolute; top: 56; left: 360;"><b>Browse Media Content</b></span>

    <!-- Item counter at lower right. Displays only if button menu is scrollable -->
    <span id="itemCounterSpan" style="font: 20pt Arial; color: #f2f2f2; width: 610; Height: 42; text-align: right; display: block; position: absolute; top: 656; left: 285;">
        <span id="counterNum">1</span>&nbsp;of&nbsp;<span id="counterTotal"></span>
        <span id="arrowUp" class="arrowUp" onclick = "pageUpDown('up')"></span>
        <span id="arrowDown" class="arrowDown" onclick = "pageUpDown('down')"></span>
    </span>
    <!-- End item counter at lower right -->

    <!-- Table for buttons at left -->
    <table id="listTable" border="0" cellpadding="0" cellspacing="3" style="position: absolute; top: 114; left: 10;">
        <tr><td><span id="Left1" class="button1" MCFocusable="true">Sub-category 1</span> </td></tr>
        <tr><td><span id="Left2" class="button1" MCFocusable="true">Sub-category 2</span></td></tr>
        <tr><td><span id="Left3" class="button1" MCFocusable="true">Sub-category 3</span></td></tr>
        <tr><td><span id="Left4" class="button1" MCFocusable="true">Sub-category 4</span></td></tr>
        <tr><td><span id="Left5" class="button1" MCFocusable="true">Sub-category 5</span></td></tr>
        <tr><td><span id="Left6" class="button1" MCFocusable="true">Sub-category 6</span></td></tr>
        <tr><td><span id="Left7" class="button1" MCFocusable="true">Sub-category 7</span></td></tr>
    </table>
    <!-- End table for buttons at left -->

    <!-- Note: the following is a span containg a scrollable table; it works by scrolling selectable content -- in this case, each TD is selectable. If you add non-selectable TDs to the table, they will not automatically scroll into view (unless they happen to be in the same row as selectable ones that can do the scrolling for them). If you want to enable scrolling of content that is a mix of selectable and non-selectable elements, you can place these elements in an iFrame (for an SDK template of this, use NewsArticle.htm) -->
    <span id="scrollspan" MCScrollable="true" style="position: absolute; top: 108; left: 335; width: 610; height: 520; overflow: hidden;">
    <!-- Do not set table's position to absolute, or scrolling will not work -->
    <table border="0" cellpadding="5" cellspacing="0" width=610 class="text1">
        <tr>
            <td align="center" tabindex=0 hidefocus="true" class="photoTD" MCFocusable="true"><img src="Images/Photo1.gif"/><br><b>Test</b><br>Description</td>
             <td align="center" tabindex=0 hidefocus="true" class="photoTD" MCFocusable="true"><img src="Images/Photo1.gif"/><br><b>Item 2</b><br>Description</td>
            <td align="center" tabindex=0 hidefocus="true" class="photoTD" MCFocusable="true"><img src="Images/Photo1.gif"/><br><b>Item 3</b><br>Description</td>
        </tr>
        <tr><td height=20></td></tr>
        <tr>
            <td align="center" tabindex=0 hidefocus="true" class="photoTD" MCFocusable="true"><img src="Images/Photo1.gif"/><br><b>Item 4</b><br>Description</td>
             <td align="center" tabindex=0 hidefocus="true" class="photoTD" MCFocusable="true"><img src="Images/Photo1.gif"/><br><b>Item 5</b><br>Description</td>
            <td align="center" tabindex=0 hidefocus="true" class="photoTD" MCFocusable="true"><img src="Images/Photo1.gif"/><br><b>Item 6</b><br>Description</td>
        </tr>
        <tr><td height=20></td></tr>
        <tr>
            <td align="center" tabindex=0 hidefocus="true" class="photoTD" MCFocusable="true"><img src="Images/Photo1.gif"/><br><b>Item 7</b><br>Description</td>
             <td align="center" tabindex=0 hidefocus="true" class="photoTD" MCFocusable="true"><img src="Images/Photo1.gif"/><br><b>Item 8</b><br>Description</td>
            <td align="center" tabindex=0 hidefocus="true" class="photoTD" MCFocusable="true"><img src="Images/Photo1.gif"/><br><b>Item 9</b><br>Description</td>
        </tr>
        <tr><td height=20></td></tr>
        <tr>
            <td align="center" tabindex=0 hidefocus="true" class="photoTD" MCFocusable="true"><img src="Images/Photo1.gif"/><br><b>Item 10</b><br>Description</td>
             <td align="center" tabindex=0 hidefocus="true" class="photoTD" MCFocusable="true"><img src="Images/Photo1.gif"/><br><b>Item 11</b><br>Description</td>
            <td align="center" tabindex=0 hidefocus="true" class="photoTD" MCFocusable="true"><img src="Images/Photo1.gif"/><br><b>Item 12</b><br>Description</td>
        </tr>
        <tr><td height=20></td></tr>
        <tr>
            <td align="center" tabindex=0 hidefocus="true" class="photoTD" MCFocusable="true"><img src="Images/Photo1.gif"/><br><b>Item 13</b><br>Description</td>
             <td align="center" tabindex=0 hidefocus="true" class="photoTD" MCFocusable="true"><img src="Images/Photo1.gif"/><br><b>Item 14</b><br>Description</td>
            <td align="center" tabindex=0 hidefocus="true" class="photoTD" MCFocusable="true"><img src="Images/Photo1.gif"/><br><b>Item 15</b><br>Description</td>
        </tr>
        <tr><td height=20></td></tr>
        <tr>
            <td align="center" tabindex=0 hidefocus="true" class="photoTD" MCFocusable="true"><img src="Images/Photo1.gif"/><br><b>Item 16</b><br>Description</td>
            <td align="center" tabindex=0 hidefocus="true" class="photoTD" MCFocusable="true"><img src="Images/Photo1.gif"/><br><b>Item 17</b><br>Description</td>
        </tr>
    </table>
    </span>

    </body>
    </html>

     
    • jef2000

      jef2000 - 2009-01-26

      Hi,

      Most browser will not allow TCP connection to a specified server and port for security reasons. The only way I see to solve this problem is the one used by knxweb. The browser does an HTTP request to a script on the same server as the web page (this is allowed by the browser) and that script on the web server side does the TCP connection to linknx.
      For the server side, you can have a look at the linknx.php script from knxweb, also available here:
      http://linknx.cvs.sourceforge.net/viewvc/linknx/knxweb/knxweb/linknx.php?revision=1.2&view=markup

      For more details on how to call the above php script from the javascript inside the browser, google search for "XMLHttpRequest" and you'll find answers. The problem of this method is that some aspects arebrowser dependent. That's why I used the JQuery framework in knxweb to hide these differences. Using JQuery, the javascript request would look like this:

      var req = jQuery.ajax({ type: 'post', url: 'linknx.php?action=cmd', data: "<read><objects><object id='ecl_wc'/></objects></read>", processData: false, dataType: 'xml',
      success: function(responseXML, status) {
          var xmlResponse = responseXML.documentElement;
          if (xmlResponse.getAttribute('status') != 'error') {
              var objs = xmlResponse.getElementsByTagName('object');
              .......
          }
      }
      });

      Regards,

      Jean-François

       
    • kervy

      kervy - 2009-01-27

      the use of a webserveur is obligatory?

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.