From:  georgeludwig@gmail.com
Date:  26 May 2006 05:41:35 Hong Kong Time
Newsgroup:  news.mozilla.org/netscape.public.mozilla.jseng
Subject:  

using rhino to process js embedded in html?

NNTP-Posting-Host:  24.5.69.81

I'm working on a screen-scraping application and I need to access some
functiomnality that has been written in javascript. I've gon through
the rhino stuff, but I'm not sure I can do what I want.

Right now, I retrieve an html page and extract the JS source and get
this (it's used to navigate to another page of search results):

function cmdSubmit(pForm, pAction, pCode, pPage, pOrder)
{
  var form = document.form2;
  if (pForm != null) form = pForm;
  if (pAction != "") form.action.value = pAction;
  if (pPage != "")   form.page.value = pPage;
  if (pOrder != "")  form.order.value = pOrder;
  if (pCode != "")   form.code.value = pCode;

  form.submit();
}

When I execute this command, it fails with this message:
org.mozilla.javascript.EcmaError: ReferenceError: "document" is not
defined.

Of course, rhino does not have access to the document object.

Is there any way to do what I'm trying to do with rhino? It seems that
netscape used to have something, but you needed an entire app server
environent to make it run.

Thanks for any help,

George