[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Embedding Java Script



At 06:38 PM 2/15/98 +0000, Amitava Basu wrote:
>Can anyone tell me how do I go about embedding JavaScript
>in my forms page?  Is there any site where I can go to get some
>useful information.

I do this with CGI.pm on Perl for Win32 all the time; I do believe that
CGI.pm will run on MacPerl, and intend to find out in the near future, anyhow.

At the least, however, it isn't too difficult to do by hand, like this:

$JSCRIPT = <<END;
function openWin3()
{
	myWin = open("", "mainForm",

"width=200,height=200,scrollbars=yes,status=no,toolbar=no,menubar=no,screenX
=0,screenY=0,alwaysRaised=yes");

	// open document for further output
	myWin.document.open();

	// create document
	myWin.document.write("<html><head><title>On-The-Fly");
	myWin.document.write("</title></head><body>");
	myWin.document.write("<center> This HTML document has been created ");
	myWin.document.write("with the help of Javascript!!!");
	myWin.document.write("</center></body></html>");

	myWin.document.close();
}
END

print "Content-type: text/html\n\n";
print
	"<html><head><title></title>\n ".
	"<script language=Javascript>\n ".
	"<!-- START HIDING\n ".
	$JSCRIPT.
	"// -->".
	"</script></head>".
	"<body onLoad='openWin3()'>";

The best information that I've found on this is at the VooDoo Tutorial, at:
http://rummelplatz.uni-mannheim.de/~skoch/js/tutorial.htm

Hope this helps!

--Jon S. Jaques
-- Jon S. Jaques     --    The Grove Hill Pages --
--                   Now on the PerlRing!                     --
--      http://www.grovehillsys.com/scripting      --
--              jjaques@grovehillsys.com                 --
--  Linux: Salvation from Bill, Steve and Marc!  --

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch