Re: History Replacement And New Location Combined



On Jul 11, 11:22 pm, Randy Webb <HikksNotAtH...@xxxxxxx> wrote:
David Mark said the following on 7/11/2007 7:55 PM:





"Randy Webb" <HikksNotAtH...@xxxxxxx> wrote in message
news:YuednTlhAsRh9gjbRVn_vgA@xxxxxxxxxxxxxx
David Mark said the following on 7/11/2007 7:32 PM:
> In each and every page, I have up to four 'submit' buttons with their
respective onClick event handlers. If I used onSubmit event handler,
it would have to decide what event needs to be serviced, actually
getting me back (through one additional step) to the same logic I've
already applied.
Okay, but instead of:

<form method="get" action="javascript: savePage();"
onSubmit="checkForm();">

Why not something like:

<form method="get" onsubmit="if (checkForm()) savePage(); return false">
<form method="get" action="someFileSoThatNonJSPeopleGoSomewhere.php"
onsubmit="return someFunction()">

function someFunction(){
if(checkForm()){
savePage();
return false;
}
return true;
}

I went over that with him. His is a JS-only app. So he will need to
generate the form with JS and present a NOSCRIPT warning to everyone else.

No, you put the non-JS warning on the page and then you replace it using
JS. If you put it in a noscript element and the script has an error,
then the JS crowd gets nothing.

I don't agree with that. In an HTML document, I say just
document.write the form and pair it with a NOSCRIPT tag. In an XHTML
document that is actually served as XHTML, I would insert the nodes
that make up the form after the page loads. Under what circumstances
would such a script error?

If you do it the other way, you must either wait for the page to load
to replace the warning message or simulate the DOMContentLoaded for
browsers that don't support it (ie put the script near the bottom of
the page, possibly with a timeout and hope for the best.) If you go
with the former method, you get a flash of the warning message, the
latter is a lot of trouble and not foolproof (as few things are with
IE.)

.