Hello all, this is my first post to this list.  I am fairly new to
WWW::Mechanize, but I have been in pretty good shape so far.  I have run
into a page that has a javascript link to another page and I can't get by
it. I am trying to use push_input to get by that way, but I can't seem to
translate the javascript to see what I should configure. Below is the
javascript snippet. Any help is appreciated.

Thanks.

~Paul

<script language="JavaScript" type="text/javascript">
    function setAndSubmit(actionName, formObj, varNameAndValueArray)
    {
         for(var i = 0; i < varNameAndValueArray.length; ++i)
         {
              
eval("document."+formObj.name+"."+varNameAndValueArray[i]+".value=\""+varNameAndValueArray[++i]+"\";");
         }

        //if NN4
        if(document.layers)
        {
            var whichDummy;
            //if there is more than one form variable named dummy
            //find the first one that hasn't been renamed and use it
            if( formObj.dummy.length != null )
            {
                var done = false;
                for(i=0; i < formObj.dummy.length && !done; ++i)
                {
                    if( formObj.dummy[i].name == "dummy" )
                    {
                        whichDummy = i;
                        done = true;
                    }
                }
                if( !done )
                {
                    alert("Error: All dummy variables used up!");
                }

eval("document."+formObj.name+".dummy[whichDummy].name=\""+actionName+".x\"");
            }
            //if there is only one dummy field, just use it
            else
            {

eval("document."+formObj.name+".dummy.name=\""+actionName+".x\"");
            }
            formObj.submit();
        }
    }
</script>


Above is the function that gets passed the variables, here is the
snippet that calls the function.


<input type=hidden name=GroupId value="">
<td valign=top>
<!-- ugly script to write out image link for netscape or image button for IE-->
<script language="JavaScript" type="text/javascript">
   //if NN4
   if(document.layers)
   {
       document.write("<input type=\"hidden\" name=\"dummy\" value=\"1\" />");
       document.write("<a
href=\"javascript:setAndSubmit('EDIT_STORE_RULES_GROUP',
document.updateAccount, ['GroupId', '524789']);\"><img
src=\"/nhin/jsp/images/editstorehours.gif\"
alt=\"EDIT_STORE_RULES_GROUP\" border=\"0\" /></a>");
   }
   else
   {
       document.write("<input type=image
src=\"/nhin/jsp/images/editstorehours.gif\"
name=\"EDIT_STORE_RULES_GROUP\"
onclick=\"javascript:setAndSubmit('EDIT_STORE_RULES_GROUP',
document.updateAccount, ['GroupId', '524789']);\"
alt=\"EDIT_STORE_RULES_GROUP\" />");
   }
</script>

</td>

Reply via email to