Another Blonde Question...

T

Terry Olson

The wrapping is caused by the auto wrap my editor does, in actually all
these lines are only 80ish. I will copy it unword wrapped next time. This is
why I try to avoid posting entire things of code.

And top post because all the stuff below is unimportant, I only read the
last thing posted, if I want to read the stuff before it, I read the posts
before it. My habit, my preferance.

RobG said:
Terry said:
that isn't very helpful, I got this window.open code striaght from my
javascript codebook. What's wrong with it? [snip]
There are really to many errors in the syntax of your code in a whole.
Please correct them first and then we can continue discussing...

Please don't top post, it destroys the flow of
the conversation.

There are a stack of errors caused by wrapping, please
manually wrap your posts at about 60 characters to allow
for quote marks. It took me half an hour just to get
your code to "work".

Some minor errors:

<style> should be: <style type="text/css">
<script> should be: <script type="text/javascript">
missing </form> tag

<body onLoad="fcus()">
// Calling focus on a table element that doesn't exist yet
// This may error if the browser executes the script
// faster than it draws the table ... or it may not
// to save doubt, put it at the bottom of the page.

The error is in your logic. When w=4, you end the row and
then start a new one when w=5, but when the letter changes,
you re-set w. So if the first letter has 6 cells, you
write 4, then a new row, then two more. Then you start on
the next letter with w=1 again and write 4 more cells
before ending the row so now this row has 6 cells.

You need to make the cell counter independent of the letter
counter. This error was staring you in the face, you are
writing w to the page.

Rob.

PS. This is a pretty awful way of doing what you are doing.
If it really came from a book, I'd toss it. Your CSS has
issues too, but that's for another group to fix.
 
R

Richard Cornford

RobG said:
Famous last words... I'll grant you some qudos if
the OP doesn't - great effort.

:)

Over-confidence is a very effective barrier to learning anything new.
Just one point - the for loops are explicity told to
itterate 11 times - which is the length of the lttr array.
Would it be better to change the lines (x2) with:

for (var i = 1; i <= 11; i++) {
to
for (var i = 1; i <= lttr.length; i++) {

so that the varible lttr can be modified at the point it is
declared/created without needing further mainenance of the
code?

I entirely agree, and for exactly those reasons. I had noticed the
potential for removing the constants, dismissed it when I noticed the
odd structure that was the original - lttr - (it wasn't an array so
would not have had a meaningful - length - property), and then forgot to
re-instate the idea when I changed - lttr - into an array.

That wasn't all I forgot either; In the original document.wirtten CSS
there are CSS units missing form a couple of non-zero lengths (- in -
are probably not the best units for screen media anyway) and I neglected
to escape a couple of '</' sequences from original strings.

Also, it is a bit questionable to be using - parseFloat - to produce
numbers that are going to be controlling a - for - loop and incremented
by one each time. It won't stop anything from working but maybe -
parseInt - would better fit the situation (though some regular
expression checking of the user's input is probably a good idea as
well).

I also meant to say that SCRIPT elements are no allowed to be children
of FORM elements with the HTML 4 strict DTD, instead of BODY. (It is
true for both but the script is actually in a FORM so that is the one
that is relevant.)

Richard.
 
K

kaeli

There is nothing wrong with my coding, it works just fine, my mistake was
just in adding the divide by 5 if statement. I should have just added the
new row in with the end of row statement. Once I fixed it, everything worked
fine. If my coding is so horribly wrong, point out even one error.

Take it easy, champ.
We can all improve our coding. Myself included. Part of being a good coder is
to listen to what others have to say about your code. No one said it had
major errors. We all pointed out that it could improve. You use eval, which
is a memory eater and not needed, you use syntax that tends to not be as
cross-browser as most of us like, you aren't using the type attribute in your
script, which is highly recommended, and you should really use semi-colons
just for readability and less error-prone behavior. You use the same variable
name to mean different things, which can cause errors or just make code hard
to read.

It's not that you're a bad coder. No one was trying to insult you.

Have a cookie. Smile. Learn from other people.
I know I've learned a TON from the people on this group. An open mind is a
wonderful thing.

Have a nice day. Glad you got it working to your satisfaction.

--
--
~kaeli~
Found God? If nobody claims Him in 30 days, He's yours to
keep.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
 
D

Dr John Stockton

JRS: In article <Efqbd.735815$gE.721597@pd7tw3no>, dated Thu, 14 Oct
2004 07:53:08, seen in Terry Olson
The wrapping is caused by the auto wrap my editor does, in actually all
these lines are only 80ish. I will copy it unword wrapped next time. This is
why I try to avoid posting entire things of code.

And top post because all the stuff below is unimportant, I only read the
last thing posted, if I want to read the stuff before it, I read the posts
before it. My habit, my preferance.

My preference is not to help those who ignore accepted Usenet and
newsgroup standards, and thereby make things more difficult to me. I am
not alone in this. You need to remember that, from the point of view of
your potential readers, you are a person of little significance; but
those who would be able to answer your questions are necessarily of
importance to you.

Read also the newsgroup FAQ, section 2.3, especially paragraphs 1 & 2,
4, 6, 9.
 
M

Michael Winter

On Thu, 14 Oct 2004 03:13:07 +0100, Richard Cornford

[snip]
SCRIPT elements may not be children of TABLE elements in valid HTML 4.
Correct.

The only way round that restriction in this context is to write the
entire table out at this point (though the strict HTML 4 DTD doesn't
allow SCRIPT elements to be children of BODY either).

Incorrect. :p

From the Strict DTD:

<!ELEMENT BODY O O (%block;|SCRIPT)+ +(INS|DEL) -- document body -->

[snip]

Mike
 
M

Michael Winter

On Thu, 14 Oct 2004 09:15:10 +0100, Richard Cornford

[snip]
I also meant to say that SCRIPT elements are no allowed to be children
of FORM elements with the HTML 4 strict DTD, instead of BODY.

Sorry, but to continue my last correction:

(It is true for both but the script is actually in a FORM so that is the
one that is relevant.)

In both cases, SCRIPT is special in that it is the only element that may
exist outside the scope of a block element.

Mike
 
M

MikeB

Dr John Stockton said:
JRS: In article <Efqbd.735815$gE.721597@pd7tw3no>, dated Thu, 14 Oct
2004 07:53:08, seen in Terry Olson


My preference is not to help those who ignore accepted Usenet and
newsgroup standards, and thereby make things more difficult to me. I am
not alone in this. You need to remember that, from the point of view of
your potential readers, you are a person of little significance; but
those who would be able to answer your questions are necessarily of
importance to you.

Your help is gratefully accepted by the occasionally stumped pros and the
sometimers like myself that lurk about, but I can't help thinking in this
instance you were suitably warned by the OPs subject line... ;-)
 
R

Richard Cornford

Michael said:
Sorry, but to continue my last correction:

<!ELEMENT FORM - - (%block;|SCRIPT)+ -(FORM) -- interactive form


In both cases, SCRIPT is special in that it is the only
element that may exist outside the scope of a block element.

Yes, I was wrong about that. I should have actually checked the DTD
instead of relying on my memory, which recalled that the element's could
only have block contents and that SCRIPT is inline, ignoring the
exceptions.

Richard.
 

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

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top