I'll try to answer all your posts at once.
[snip]
At a minimum, I've been thinking, the browser can take all
the form data and replicate it somewhere, perhaps in another window,
so that all your data won't get lost if you hit the submit and it
turns out you no longer have an internet connection.
Some browsers allow you to go back in your history to submitted forms, and
keep the submitted data. You probably can't re-submit as the session id
will have changed, but you could copy your entries. Out of habit now, I
copy the data before submitting so I can re-submit immediately.
[snip]
I'll implement this. Does the form data on the parent page still get
submitted to the server in the normal way?
It should, provided you don't cancel the submission with "return false;".
[snip]
var elem = document.forms[0].elements,
temp = ['<h1>You just wrote:<\/h1>'];
[snip]
So, in this line:
temp = ['<h1>You just wrote:<\/h1>'];
you are creating the variable temp as a global variable because you are
not using the 'var' keyword?
Not quite. Look closer on the line prior. You'll see that it ends with a
comma, not a semicolon. The line you refer to is a *continuation* of the
var statement so temp is local.
And it is automatically an array because of the brackets that you use?
Exactly.
Could I also do this?
temp[] = '<h1>You just wrote:<\/h1>';
Does that work the same?
No. It's a syntax error.
[snip]
You don't define the method join() so I'll assume it is a built-in
method that all arrays possess.
Indeed. It concatenates all elements of the array, separating them with
the given argument (type-converted to a string). As I used an empty
string, it's a direct concatenation.
Finally, this:
temp[temp.length]
You use temp.length to make sure that the string you are building up
gets put into the same row,
No. Quite the opposite.
As you know, arrays are zero-order, so a length of 2 implies that elements
0 and 1 exist.
Now think. If I assign to element array.length I'll be assigning to
element 2. That is, I'll be appending a new element. That's what happens
with the temp array; a large number of append operations. The reason for
this is that it should be quicker than string concatenation. All the
implementation need do is insert references into a linked list, rather
than allocate memory for the two strings, copy the characters, delete the
original strings, and assign the new string to an identifier.
[snip]
[snip]
No luck yet. This was in a print "" block in PHP, and I kept getting
parse errors because of all the quote marks. It was trouble trying to
escape them correctly. To make things easy on myself, I redid it like
this, which was easier to escape:
function openInNewWindowString(windowText) {
var windowString = '';
windowString += 'javascript:';
windowString += windowText.replace(/\"/g, '\\\"');
However, you missed the outer quotes. The variable, windowString, must end
up as either
javascript:"..." or javascript:'...'
Your code generates
javascript:...
By the way, please don't use tabs for indentation. Use spaces instead.
[snip]
I keep doing variations trying to find something that will work. In the
meantime, FireFox is giving me these error messages:
Hopefully the previous suggestions will help with some of your problems.
Error: document.getElementById("optionalDiv") has no properties
You haven't shown any code related to that, so I couldn't say for certain.
However, the sensible guess is that there's no element with the id,
optionalDiv.
Error: docWindow is not defined
In your original post, you'll see (abridged):
window.open(...);
docWindow.focus();
Notice that you didn't save the window reference. You probably wanted
var docWindow = window.open(...);
docWindow.focus();
Security Error: Content at may not load data from about:blank.
Couldn't tell you. I've never seen that error before.
Hope that helps,
Mike[/QUOTE]