Geoff Cox a écrit :
On Thu, 29 Sep 2005 11:36:41 +0200, ASM
<st*********************@wanadoo.fr.invalid> wrote:
Stephane.
Thanks for trying this approach. I haven't seen any mention of this
befofe.
I was wondering whether if this uses "a sort of reserved word" whether
this can cause any problems?
as said by otherwise
'name' is a reserved word for everything in javascript
in this try-demo this reserved word is used for what it was done
that's to say : to give a name to an object
because 'window' is the all first object in javascript
and
because 'window' can be omitted
if your window has a name and you do i.e. alert(name)
that would have to open an alert-box with the name of the window
so, this try-demo can become :
file 'page1.htm' :
<html> <title>page 1</title>
<script type="text/javascript">
function go(aName) { name=aName; }
</script>
<h3>page 1</h3>
<form action="page2.htm">
Enter your name :
<input type=text name="Name" onchange="go(this.value);">
<input type=submit value=GO>
</form></html>
file 'page2.htm' :
<html>
<title>page 2</title>
<body onload="document.forms[0].Name.value = name;">
<h3>page 2</h3>
<form>
Your name is :
<input type=text name="Name">
</body></form></html>
As you can see now, using IE (don't more work with FF),
what was your variable 'name'
was in fact the reserved word 'name'
and, because used alone, was : name of window
This particularism (a window records its name)
is useful with popups
--
Stephane Moriaux et son [moins] vieux Mac