#!/usr/bin/perl
#Hash Array containg list of pages to display depending on test result
+s.
%resultURLs = (
'PASS', 'http://www.mscorp.org/cgi-bin/invo.pl',
'FAIL', 'http://www.mscorp.org/js/invorder.pl/nojs.htm
+l'
);
#URL of this script.
$scriptURL = "/cgi-bin/invorder_djs.pl";
#Read hidden form results and decide what to do.
require "lib/cgi-lib.pl"; #You can use CGI.pm if you like.
&ReadParse;
if (!$in{'jstest'}){
&runJSTest;
}
else{
$result = uc $in{'jstest'};
$url = $resultURLs{$result};
print "Location: $url\n\n";
exit;
}
#Print HTML output that handles the testing.
sub runJSTest{
print <<END_OF_HTML;
<html>
<head>
<title>CHECKING YOUR SYSTEM FOR INSTALLED COMPONENTS...</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1
+">
#Redirect to error page if JavaScript found within 5 seconds.
<meta http-equiv="refresh" content="5;URL=$scriptURL?jstest=fail">
</head>
<body bgcolor="#FFFFFF" onload="testJS()">
<script language="JavaScript">
<!--
#If JavaScript is enabled this functions is run thereby returning a va
+lue of true.
function testJS() {
document.jstestform.submit();
}
//-->
</script>
<table width="7%" border="0" cellspacing="0" cellpadding="0" align="ce
+nter">
<tr>
<td nowrap align="center">
<p><b><font face="Arial">PLEASE WAIT<b><img src="/images/pe
+riod_ani.gif" width="18" height="12"></b></font></b></p>
<p><font face="Arial"><b>CHECKING YOUR SYSTEM FOR
+ INSTALLED COMPONENTS<img src="/images/period_ani.gif" widt
+h="18" height="12"></b></font></p>
<p><b><tt><font face="Arial">IF THIS PAGE DOES NO
+T CHANGE WITHIN 10 SECONDS, PLEASE <a h
+ref="$scriptURL?jstest=fail">CLICK HERE</a>.</font></tt></b></p>
</td>
</tr>
</table>
#Hidden form that returns the results, if JavaScript is enabled.
<form name="jstestform" method="post" action="$scriptURL">
<input type="hidden" name="jstest" value="pass">
</form>
</body>
</html>
END_OF_HTML
exit;
}
2001-03-13 Edit by Corion : Fixed formatting
2001-03-13 Edit by akm2 : Enhanced code readibility
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|