onChange triggered by Javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Cainnech
    New Member
    • Nov 2007
    • 132

    #16
    Am I right to assume that such a function can only be called from inside the element?

    Because in this code:
    Code:
    <SELECT id=results_select_meeting jQuery1270339382734="153">
    I don't see any onchange call?
    Can anybody tell me how this is done then?

    Comment

    • Dormilich
      Recognized Expert Expert
      • Aug 2008
      • 8694

      #17
      Originally posted by Cainnech
      Am I right to assume that such a function can only be called from inside the element?
      no.

      my guess is it’s called somewhere in the self-written part using jQuery.

      Comment

      • Cainnech
        New Member
        • Nov 2007
        • 132

        #18
        Well I'm afraid I have no idea where to look.

        I'm attaching two .txt-files here hoping that someone here has a clue where the function is located.

        Any help is appreciated.
        Attached Files

        Comment

        • Cainnech
          New Member
          • Nov 2007
          • 132

          #19
          does anybody know of a way to log the functions that are being called on a page?

          I would like to log all operations that the page does in an effort to discover what function is displaying the content.

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #20
            use Firebug for that.

            Comment

            • ÜnLoCo
              New Member
              • Apr 2010
              • 1

              #21
              Firebug and then inline code finder if you want


              but for jQuery it's goes something like this :

              element.change( function(){//do it})
              you'll probably be looking for this code

              $('select').cha nge( function(){//getContent} )
              just take a look at their js.

              more info http://api.jquery.com/change/

              Comment

              • Cainnech
                New Member
                • Nov 2007
                • 132

                #22
                I tried Firebug but I'm afraid it's not of any use because the page that I want to inspect is an online page so I can't add the javascript library to it.

                Can I ask that anyone take a look at this because this is the only thing blocking me. So I can't move ahead.

                The url of the page I'm scraping is http://form.horseracing.betfair.com/timeform and it's on the tab Results.

                Thanks!

                Comment

                • Cainnech
                  New Member
                  • Nov 2007
                  • 132

                  #23
                  I would like to try to trigger the onchange using jQuery.
                  Code:
                  $('#results_select_meeting').trigger("onchange");
                  But how can I perform this command from my parent window while it's the iFrame that is jQuery enabled and not the parent frame?

                  Comment

                  • Cainnech
                    New Member
                    • Nov 2007
                    • 132

                    #24
                    Guys, I'm getting pretty desperate here.

                    Is there any other forum where there are some good jQuery experts that might be able to help me?

                    This is the code I'm using for my HTA.
                    When you run it, got to the tab Results to see where the select is that I'm using.
                    Code:
                    <html>
                    <head>
                    <script src="http://form.horseracing.betfair.com/static/js/jquery-1.2.3.min.js" type="text/javascript" charset="utf-8"></script>
                        
                    <script language="javascript">
                    
                    function test()
                    {
                    document.getElementById('scrapeframe').contentWindow.document.getElementById('results_select_meeting').selectedIndex = 2;
                    }
                    </script>
                    </head>
                    <body>
                    <input type="button" value=" TEST " onclick="test();">
                    <br>
                    <iframe width="1000px" height="800px" id="scrapeframe" src="http://form.horseracing.betfair.com/" application="yes"></iframe>
                    </body>
                    </html>
                    I refuse to believe that there is no way to simulate an onchange event in jQuery.
                    I just don't know how. So if anyone can test this on my code, that would be great.

                    Comment

                    • Cainnech
                      New Member
                      • Nov 2007
                      • 132

                      #25
                      A small update

                      Due to the fact that this was an extremely difficult problem to which nobody knew the answer, I ended up "fooling" the application that there was someone who was actually selecting the option by hand.

                      Code:
                      document.getElementById('scrapeframe').contentWindow.document.getElementById('results_select_race_time').selectedIndex = index + 1;
                      document.getElementById('scrapeframe').contentWindow.document.getElementById('results_select_race_time').focus(document.getElementById('scrapeframe').contentWindow.document.getElementById('results_select_race_time').options[index + 1].value);
                      
                      function up()
                      {
                          var WshShell = new ActiveXObject("WScript.Shell");
                          WshShell.AppActivate("Races");
                          WshShell.SendKeys ("{UP}");
                      }
                      So this way the application selects the value below the one I actually need, it puts the focus on that option and then I simulate a keypress UP. As if a user was pressing the up key.

                      Might not be graceful, but hey, it works and that's the most important thing.

                      Comment

                      Working...