Javascript query.

J

John Fitzsimons

Hi,

I have recently been trying to put a book search on my site. I am part
of the way there with a free script. The results being ;

http://home.vicnet.net.au/~johnf/xsearch-5.2.htm

The problem however is that the results are on three lines with a
blank between each "hit". Very inefficient.

Could anyone please ;

(1) Tell me how I could get each of the results to display on one line
eg. Title Author Price.

(2) Tell me how to show the results of (1) without a blank line
between each "hit".

I presume I can/should change either/both of the files ;

http://home.vicnet.net.au/~johnf/xsearch-5.2.htm
http://home.vicnet.net.au/~johnf/db.js

BUT I don't know how/where they need to be changed. Can anyone
help me please ? With either task. TIA.

Regards, John.
 
S

Steve Pugh

John Fitzsimons said:
I have recently been trying to put a book search on my site. I am part
of the way there with a free script. The results being ;

http://home.vicnet.net.au/~johnf/xsearch-5.2.htm

A nice blank page for anyone who has JavaScript disabled.

And the user has to download the complete listing to their browser in
order to search it, not a huge problem at the moment as you only have
tens of books, but more problematic when you have thousands. Consider
a database solution instead.
The problem however is that the results are on three lines with a
blank between each "hit". Very inefficient.

Could anyone please ;

(1) Tell me how I could get each of the results to display on one line
eg. Title Author Price.

(2) Tell me how to show the results of (1) without a blank line
between each "hit".

I presume I can/should change either/both of the files ;

http://home.vicnet.net.au/~johnf/xsearch-5.2.htm
http://home.vicnet.net.au/~johnf/db.js

Nope, neither of them

http://home.vicnet.net.au/~johnf/xsearch-5.2.js

Find the line that reads
document.write("<span class='xtitle'>"+records[rc].link+"</span><br>")
and delete the <br>

Then find the line that reads
document.write("<table border=0 width=500><tr><td><span
class='xresult'>"+records[rc].description+"</span></td></tr></table><span
class='xlocation'>"+tmp+"</span><br><br>")
and delete all the table elements and the last <br>, so you end up
with
document.write("<span
class='xresult'>"+records[rc].description+"</span><span
class='xlocation'>"+tmp+"</span><br>")

You may need to add some spaces between the spans to keep the various
bits of information from running into each other.

Steve
 
J

John Fitzsimons

John Fitzsimons <[email protected]> wrote:

Hi Steve,
A nice blank page for anyone who has JavaScript disabled.

Okay, but better JavaScript than nothing. :)
And the user has to download the complete listing to their browser in
order to search it,

Interesting. I didn't know that.
not a huge problem at the moment as you only have
tens of books, but more problematic when you have thousands. Consider
a database solution instead.

Would love a database solution but don't know how to code one and my
web site doesn't allow server side scripting. I might be able to find
a site that does allow it though. What would be your recommendations
for such a database ? Are there any programs/tutorials/examples that
you/anyone else here could point me to please ?
The problem however is that the results are on three lines with a
blank between each "hit". Very inefficient.

S/B

document.write("<span
class='xresult'>"+records[rc].description+"</span><span
class='xlocation'>"+tmp+"</span><br>")

You may need to add some spaces between the spans to keep the various
bits of information from running into each other.

Well, you fixed both of my queries. Excellent work. Many thanks. :)

I wasn't however able to get blank spaces between the first two
fields. When I try to put "padding" in the underline extends where
there are no characters. :-(

There are also a few other very minor points that someone may know
how to fix.

(1) I changed the display to show 50 items. That is fine and the
"next" button works okay BUT the number of pages is incorrect.

For example, a hundred results should show page 1 and 2 at the
bottom. I get instead ;

previous page 1 2 3 4 5 6 7 8 9 10 11 Next
page

(2) I am happy to have XSEARCH5.2 as a link in appreciation at the
bottom of the page but would like to change it at the top. For some
odd reason I cannot find where/which file has the "XSEARCH5.2"
word. So cannot change it. Can anyone explain where it is please and
if necessary how to change it if it isn't simply a text replace.

All input/help appreciated.

Regards, John.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top