in reply to Re^4: WIN32::IE::Mechanize - can't follow link - JavaScript involved
in thread WIN32::IE::Mechanize - can't follow link - JavaScript involved
You are right> I didn't notice that the image tag was inside a
<a HREF="JavaScript:JSubmitForm()" onMouseOver="status='Perform Search'; return true" onMouseOut="status='';">
tag. When you click the image, it its the HREF attribute that fires the jSubmitForm() sub from javascript.
The "go" buttons are interchangeable because thet all call the same JS function.
So we return to my previous post: if you get the linked javascript you'll find the source of the function:
function JSubmitForm() { document.Content.Name.value = document.Search1.Name.value; document.Content.CrdNumber.value = document.Search2.CrdNumber.valu +e; document.Content.SecNumber.value = document.Search3.SecNumber.valu +e; if (eval("document.Search1.SearchType[0].checked") == true) { document.Content.SearchType.value = 1; } if (eval("document.Search1.SearchType[1].checked") == true) { document.Content.SearchType.value = 2; } if (eval("document.Search1.SearchType[2].checked") == true) { document.Content.SearchType.value = 3; } if (eval("document.Search4.NumRows[0].selected") == true) { document.Content.NumRows.value = document.Search4.NumRows[0].v +alue; } if (eval("document.Search4.NumRows[1].selected") == true) { document.Content.NumRows.value = document.Search4.NumRows[1].v +alue; } if (eval("document.Search4.NumRows[2].selected") == true) { document.Content.NumRows.value = document.Search4.NumRows[2].v +alue; } if (eval("document.Search4.NumRows[3].selected") == true) { document.Content.NumRows.value = document.Search4.NumRows[3].v +alue; } document.Content.submit(); return false; }
As you can see, the function does nothing more than setting the hidden fields SearchType and NumRows to the appropriate values depending how the form was compiled and then submit the form.
This means that you should be able to completely bypass the downloading of the form, and produce a simple GET with the correct parameters that retrieves directly the result you want.
Rule One: Do not act incautiously when confronting a little bald wrinkly smiling man.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: WIN32::IE::Mechanize - can't follow link - JavaScript involved
by Ninth Prince (Acolyte) on May 22, 2008 at 19:39 UTC | |
by psini (Deacon) on May 22, 2008 at 19:51 UTC | |
by Ninth Prince (Acolyte) on May 22, 2008 at 20:37 UTC |