Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Javascript query.

Reply
Thread Tools

Javascript query.

 
 
John Fitzsimons
Guest
Posts: n/a
 
      04-20-2004

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.

 
Reply With Quote
 
 
 
 
Steve Pugh
Guest
Posts: n/a
 
      04-20-2004
John Fitzsimons <(E-Mail Removed)> wrote:

>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

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <(E-Mail Removed)> <http://steve.pugh.net/>
 
Reply With Quote
 
 
 
 
John Fitzsimons
Guest
Posts: n/a
 
      04-21-2004
On Tue, 20 Apr 2004 14:34:32 +0100, Steve Pugh <(E-Mail Removed)> wrote:

>John Fitzsimons <(E-Mail Removed)> wrote:


Hi Steve,

>>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.


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.


< snip >

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


S/B

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


< snip >

>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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Generated JavaScript vs. Manually Created JavaScript: Which one comes first? Nathan Sokalski ASP .Net 4 11-08-2007 07:24 AM
JavaScript or not JavaScript Mark Rae ASP .Net 36 09-09-2006 01:12 PM
href="javascript:func()" vs href="#" onclick="javascript:func()" CRON HTML 24 06-20-2006 08:05 PM
Javascript -> Applet: variable reset after method call from javascript?! mcdeveloper Java 1 06-13-2006 08:34 AM
To Javascript, or not to Javascript Shane NZ Computing 5 08-30-2005 09:33 PM



Advertisments