Try calling it as a JScript Method; document.parentWindow.execScript('showDetails()', 'JavaScript');
Or, the ExecString() may not recognize JavaScript as a language, leave out the language and let it default to JScript. Take a look at VBScript Execute (string) and Eval(expression) also, they might help. Mark ----- Original Message ----- From: "Werner G Mathis" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: 04 January, 2002 3:16 AM Subject: Calling JavaScript from within Perl > Hi all, > > I am trying to automate user responses to a web application via a perl > script which controls MS Internet Explorer. For that my perl script starts > MSIE, navigates to the application, and enters the required data. Now, when > navigating to the web application, the web server sends me a html page > which contains a javascript function like the following: > ... > <SCRIPT language=JavaScript> > function showDetails(action,keydetail) { > > document.assetList.action = action; > document.assetList.Key.value = keydetail; > document.assetList.submit(); > return false; > } > </SCRIPT> > ... > > I need to call this function in order to have the next page of the > application being displayed. How can I call this java script function from > within my .pl script (The parameters 'action' and 'keydetail' are known by > the perl script), which looks like: > > use OLE; > $IExplorer = CreateObject OLE "InternetExplorer.Application" || > die "CreateObject: $!"; > $IExplorer->{Visible} = 1; > $IExplorer->Navigate('<web application url>'); # Application sends back a > html containing a JavaScript function > ... > > The only thing I have found so far is 'execScript' from MSIEs object model, > but the following code doesn't work and there seems to be almost no > information nor samples on Microsofts Web pages on how to use that: > $IExplorer->execScript('showDetails()', 'JavaScript'); > > Has anybody experience in this area or can anybody give me a pointer? > > Thanks for your help and kind regards, > Werner > -------------------------------------------------------------------------- ------------------------- > > Werner Mathis > IBM Strategic Outsourcing, e-Business Service Delivery, Dept. 00/772 > A-1020 Vienna, Austria, Lassallestrasse 1, LAS2001 > > Phone: (+43-1-)21145-4430, Fax: (+43-1-)21145-4490 > Lotus Notes: Werner G Mathis/Austria/IBM@IBMAT > Profs: MATHIS@IBMAT > e-mail: [EMAIL PROTECTED] > > _______________________________________________ > Perl-Win32-Web mailing list > [EMAIL PROTECTED] > http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web > _______________________________________________ Perl-Win32-Web mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web