Just Cruzin'

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromJust Cruzin'
ToMe
SubjectcollapsibleList trouble - Cannot get more than four
Date23 May 2005 08:30
Hello!

I have a page on my site where I have a list of books I have read in the
current year. Up until lately, I was happy just to list the name of the
books, but then I decided it would be nice for my readers if I actually gave
a short blurb about each book. I wanted this to be space saving, however,
and I wanted it to all be on the same page, not multiple HTML pages.

I did a Yahoo! search and found your site and your Collapsible List
Generation demo and was thrilled - it was exactly (in form and function)
what I was looking for. I decided on your "minimalist" theme as it best
suited my needs for a sharp, professional looking layout. I have to say a
hearty "thank you!" for creating this and making it available for free. I
don't know very much in regards to coding, so people like you really make my
web presence a reality.

Unfortunately, I have come across a problem. As you can see from visiting my
test page at [URL] , I am
creating a separate list for each month of the year, and it appears I can
only have four at a time (in this case, May, April, March, and February.) I
have gone over the code many times and I cannot see any reason why the
January list shouldn't work, but it doesn't come up. Do you have any ideas?
Is there a natural limit to the number of vars one is allowed with this
javascript? If so, is there a way to only use one list, but format it so
that the month names are outside of the list format like they are now, at
the appropriate places within the list?

I apologize if I am missing something obvious, but I have no formal coding
knowledge, and I am basically what amounts to a glorified hunter-gatherer of
other people's stuff which I tweak to suit my needs. I'd appreciate any help
and ideas that you can spare.

Much obliged,

Michael Cruz
FromMe
ToJust Cruzin'
SubjectRe: collapsibleList trouble - Cannot get more than four
Date23 May 2005 13:24
Michael,

> gone over the code many times and I cannot see any reason why the January
list shouldn't work, but it doesn't come up. Do you have any ideas?

Opera's JavaScript console has the answer:

[URL]
Event thread: BeforeScript
Syntax error while loading: line 9 of inline script at [URL] :
/ASIN/0312331460">There and Back Again: An Actor's Tale</a>
---------------------------------------------------^

You have a ' in the code, but you have not escaped it (using a \ character).
Because you are also using ' quotes to delimit the line, the text is being
terminated too soon, resulting in a syntax error. Change the line to this
and it should work (notice the \ before the '):

BookListJanuary.sub[3] = new sub('<a href="[URL]/ASIN/0312331460">There and '
+'Back Again: An Actor\'s Tale</a> - Sean Astin');


Hope this helps

Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromJust Cruzin'
ToMe
SubjectRe: collapsibleList trouble - Cannot get more than four
Date23 May 2005 17:30
Thank you so much! Like I said, I know next to nothing about coding and
managed to put together my site by stumbling around in the dark. I
appreciate your help! I hope you noticed due credit was given to you on the
page.  :)

Regards,

Michael

P.S. A fan of the Roman kings, are you? That's unique, usually it's the
emperors that get all the attention.
FromJust Cruzin'
ToMe
SubjectMore collapsibleList trouble
Date26 May 2005 05:52
Tarquin,

I am sorry to bother you again, but I am at my wit's end. I have downloaded
a javascript debugger for my firefox browser, as well as searched the web
for help, but I can't seem to make any progress with either method.

I am getting huge amounts of the same error I got before. I have made sure
to backslash all ' characters, but I assume other things I am writing are
causing problems. You can check the source code at [URL], but basically what
I am doing is writing a url in the first sub and then writing a paragraph or
so description in the sub.sub. Something about my plain english  is causing
the javascript to not want to work.

I guess for my purposes my question is which characters do I need to
backslash and what else do I need to pay attention for to make this simple
application of your excellent program work. I won't be doing anything fancy,
I just want plain text to appear. The debug program will tell me a line (it
says 167, among many others) but it won't tell me which part of the line is
incorrect, or why.

It may just be the length of what I am writing, as when I wrote just "Test"
on the first couple, they worked just fine. Again, I'm sorry to be a pest,
and I appreciate your help.

Thanks!

Michael Cruz
FromMe
ToJust Cruzin'
SubjectRe: More collapsibleList trouble
Date26 May 2005 09:23
Michael,

> You can check the source code at [URL]

"404 not found" - did you get the address wrong?

> writing a paragraph or so description in the sub.sub

And I think you have just given me the answer. Quoted strings must not
contain linebreaks:

var baz = "foo bar"; //this is valid
var baz = "foo
bar"; //this is NOT valid

If you need to break it across multiple lines, use the + operator to
concatenate strings:
var baz = "foo "+
"bar"; //this is valid

That is the usual problem encountered when trying to write a long paragrah
using scripts. If this is not the problem, I will need to see the page
myself.

Cheers

Tarquin
FromJust Cruzin'
ToMe
SubjectRe: More collapsibleList trouble
Date26 May 2005 16:35
Thanks, adding the +'s solved that problem, but of course that can't be the
end, because now I have a style related question:

My apologies, the link is [URL]

A: The first line of the sub.sub paragraph (scroll down to January) has more
vertical line spacing than subsequent lines. The first line is also
indented, while those following it are not. The lack of indentation is not a
problem, but if it's possible to fix, that would be nice. Can this be solved
in the script, or is this some problem with the CSS? Writing a regular text
paragraph outside of the script doesn't have any of these problems (although
doing it that way gives no indentation, either). I tried to solve it myself
by inserting P tags before and after the paragraph of text, and this solves
the line spacing problem, but creates a bigger problem in that the paragraph
is now about three lines below the first sub (in my case, the title and
author of the book). You can check this out by clicking the expand arrow for
the book "There and Back Again" in the January list. Any other arrow in
January will highlight my original problem. Plus, using the P's takes away
all indentation, even that of the first line.

If it's possible, I would prefer the text to begin just below the first sub
(as it did pre-P tags), and I would like every line to be equally vertically
spaced with the same indentation.

Again, thanks for your time.

Michael Cruz
FromMe
ToJust Cruzin'
SubjectRe: More collapsibleList trouble
Date26 May 2005 22:49
Michael,

> The first line is also indented, while those following it are not.

You are extending the script slightly beyond its original intention (which
was to have only one line of text per sub). However, there are things that
CSS can do for us. You need to insert a block level element inside the sub,
but paragraphs are not allowed (since the list is inside a paragraph). Spans
are allowed, and we can use CSS to make them block level, and adjust the
margins to compensate for the indents and tree structure (the numbers may
need some tweaking):

BookListJanuary.sub[1].sub[0] = new sub(
  '<span style="display:block;margin:-17px 0px 0px 17px;">'+
  ' ...</span>');

That worked for me - and should fix both problems. Of course, the best way
to get the results you want is to use a script more suites to working with
multiple lines, such as my nested list collapsing script:
http://www.howtocreate.co.uk/tutorials/jsexamples/listCollapseExample.html
Unfortunately, that script is not capable of changing the ± images ...

Do with them what you will ;)

Tarquin
FromJust Cruzin'
ToMe
SubjectThank you!
Date27 May 2005 04:55
You're a genius. I hope you make more money than you know what to do with as
a result of your talents.

Thank you very much!
Michael Cruz
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.