Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Help with javascript navigation

by bauer1sc (Initiate)
on Jul 13, 2007 at 14:48 UTC ( #626456=perlquestion: print w/replies, xml ) Need Help??

bauer1sc has asked for the wisdom of the Perl Monks concerning the following question:

I've been working on this app that strips data from a web page. I have come to the point where everything is working but when trying to navigate to next page I am failing. The sites navigation is in Javascript and Im not sure how to handle javascript. Here is the code from the source on their page. let me know what you think.
<form name="frmRegisteredProjectList" method="post" action="Re +gisteredProjectList.aspx?CMSPageID=243&amp;CategoryID=19&amp;" id="fr +mRegisteredProjectList"> <input type="hidden" name="__EVENTTARGET" value="" /> <input type="hidden" name="__EVENTARGUMENT" value="" /> <input type="hidden" name="__VIEWSTATE" value="biglong garbage that wo +uld make post 5 pages long.=" /> <script language="javascript" type="text/javascript"> <!-- function __doPostBack(eventTarget, eventArgument) { var theform; if (window.navigator.appName.toLowerCase().indexOf("microsoft" +) > -1) { theform = document.frmRegisteredProjectList; } else { theform = document.forms["frmRegisteredProjectList"]; } theform.__EVENTTARGET.value = eventTarget.split("$").join(":") +; theform.__EVENTARGUMENT.value = eventArgument; theform.submit(); } // --> </script>
The link to the page is at http://www.usgbc.org/LEED/Project/RegisteredProjectList.aspx?CMSPageID=243&CategoryID=19& Thanks in advance!

Replies are listed 'Best First'.
Re: Help with javascript navigation
by Corion (Patriarch) on Jul 13, 2007 at 14:50 UTC

    I usually just inspect what requests go over the wire with a web browser, for example the Live HTTP Headers plugin for Mozilla. After looking at what requests get sent, I replicate them from my Perl code. This technique makes it really easy if the on-page JavaScript is too ugly to decipher.

      I will give that a shot! Thanks!
      Corion After looking at the live headers, the only thing that is changign from page to page it this
      __EVENTTARGET=dgRegProjList%3A_ctl29%3A_ctl2&__EVENTARGUMENT=&__VIEWST +ATE=dDwtMjc0MDE3Mjc7dDxwPGw8TEVFRElkO1Byb2plY3ROYW1lO1Byb2plY3RPd25lc +jtQYWdlSW5kZXg7Q2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QDxMRUVEIFJhdG +luZyBTeXN0ZW1zOz47Oz47Pj47dDxwPGw8XyFJdGVtQ291bnQ7VmlzaWJsZTs%2BO2w8a +TwtMT47bzxmPjs%2BPjs7Pjs%2BPjt0PDtsPGk8MT47PjtsPHQ8cDxwPGw8TmF2aWdhdG +VVcmw7PjtsPGh0dHA6Ly93d3cudXNnYmMub3JnL0Rpc3BsYXlQYWdlLmFzcHg% .... C +ONTINUES ON FOR A MILE
      The only thing changing in that garbage is the __EVENTTARGET=dgRegProjList%3A_ctl29% I havent got the slightest idea on how to replicate this. Please throw any and all suggestions at me. Thanks again monks!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://626456]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2022-08-11 05:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?