No subject

Roy Tennant rtennant at library.berkeley.edu
Mon Jul 6 13:44:55 EDT 1998


Forwarded by request. Please respond to Stephen Sloan <sloan at unb.ca>.
Roy

---------- Forwarded message ----------
Date: Mon, 6 Jul 1998 13:10:03 -0300 (ADT)
From: Stephen Sloan <sloan at unb.ca>

At the risk of being called an idiot, I've been 
experimenting with JavaScript links on some pages that are not yet 
public to my users.  One easy way to provide both JavaScript and 
more traditional HTML pages is to write a CGI script that converts
the JavaScript file "on the fly".  A link on the JavaScript version
can call the script.  This leaves you with only one file to 
maintain but gives your users an option. 

A simple perl script with a  loop such as:

open(IN,"./filename.html");
while(<IN>) {
	if (/Alternate/) { next; }
	if (/won't work/) { next; }
	if (/----/) { next; }
	if (/^<option value=\"\"/) {
		s/<option value=\"\">/<H3>/;
		s/<\/option>/<\/H3>/;
	}
	s/<form.*>//;
	s/<select.*>/<UL>/;
	s/<option value=\"/<LI><A HREF=\"/;
	s/<\/option>/<\/A>/;
	s/<\/select/<\/LI/;
	print;

}


does the job.  At least for my pages.  You can see a sample at 

http://www.lib.unb.ca/Help/english.html


Stephen Sloan
Systens Librarian
University of New Brunswick Libraries
Fredericton, NB   Canada
sloan at unb.ca








More information about the Web4lib mailing list