Friday, December 30, 2011

Book Search

I buy quite a few Christian books. One chore I thought needed automating was searching the half-a-dozen British Christian book websites to see which have the book and which is cheapest. I couldn't find an easy work around, so I scripted one. My JS skills aren't what they should be, but this seems to work.

<script type="text/javascript">
function dosearch() {
var sites=new Array();
var n=1;
for (n=1;n<=5;n++)
var fulladd = sites[n]+ escape(document.searchform.searchterms.value);;
<style type="text/css">
p {
font: 12pt Arial;
margin-left: 2cm;
margin-top: 1cm;
form {
margin-left: 3cm;
width: 10cm;
padding: 1cm;
<title>John's Christian Book Search</title>
<p>Please enter the name of the book you want to find in the box below, and then press "Search".</p>
<form name="searchform" onSubmit="return dosearch();">
<input type="text" name="searchterms">
<input type="submit" name="SearchSubmit" value="Search">

To use: copy and paste that into a text editor. Save it as "books.htm", and it should work. Any title you type into the box should result in you getting five windows/tabs, one for each of the online bookshops I use most often. Feel free to modify the code, redistribute and so on - it can be easily modified to work for any other searching. Just don't charge for it! If you want a copy of the html file, feel free to e-mail me and I'll send you one.

1 comment:

Murray said...

I also use - sorts everything one one page, but probably doesn't include all the Christian retailers.