Re: History Replacement And New Location Combined
- From: Randy Webb <HikksNotAtHome@xxxxxxx>
- Date: Thu, 12 Jul 2007 15:23:13 -0400
David Mark said the following on 7/12/2007 6:28 AM:
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 messageNo, you put the non-JS warning on the page and then you replace it using
news:YuednTlhAsRh9gjbRVn_vgA@xxxxxxxxxxxxxx
David Mark said the following on 7/11/2007 7:32 PM:I went over that with him. His is a JS-only app. So he will need to> In each and every page, I have up to four 'submit' buttons with their<form method="get" action="someFileSoThatNonJSPeopleGoSomewhere.php"respective onClick event handlers. If I used onSubmit event handler,Okay, but instead of:
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.
<form method="get" action="javascript: savePage();"
onSubmit="checkForm();">
Why not something like:
<form method="get" onsubmit="if (checkForm()) savePage(); return false">
onsubmit="return someFunction()">
function someFunction(){
if(checkForm()){
savePage();
return false;
}
return true;
}
generate the form with JS and present a NOSCRIPT warning to everyone else.
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.
You are entitled to that opinion just as I am entitled to mine :)
In an HTML document, I say just document.write the form and pair
it with a NOSCRIPT tag.
It is far more reliable to make the noscript block part of the page and then replace it with a form element using script.
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?
Hmm. Ever seen a site that uses third party scripts? Think about Google AdSense and many others that you have no control over. If you have one in your page and there is an error in that script, then yours is now broken and your visitor won't see anything at all.
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.)
I have never seen a flash of the warning message but I have never put anything other than a short message and no images on the page. Then it loads almost instantly then I place images/forms and other things. But, on a slow computer with a graphics heavy page it could be a problem.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
.
- Follow-Ups:
- Re: History Replacement And New Location Combined
- From: Dr J R Stockton
- Re: History Replacement And New Location Combined
- From: David Mark
- Re: History Replacement And New Location Combined
- References:
- History Replacement And New Location Combined
- From: abc
- Re: History Replacement And New Location Combined
- From: David Mark
- Re: History Replacement And New Location Combined
- From: abc
- Re: History Replacement And New Location Combined
- From: David Mark
- Re: History Replacement And New Location Combined
- From: abc
- Re: History Replacement And New Location Combined
- From: David Mark
- Re: History Replacement And New Location Combined
- From: Randy Webb
- Re: History Replacement And New Location Combined
- From: David Mark
- Re: History Replacement And New Location Combined
- From: Randy Webb
- Re: History Replacement And New Location Combined
- From: David Mark
- History Replacement And New Location Combined
- Prev by Date: Re: Refreshing multiple images
- Next by Date: Disable a textbox by reference
- Previous by thread: Re: History Replacement And New Location Combined
- Next by thread: Re: History Replacement And New Location Combined
- Index(es):