473,796 Members | 2,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

should this variable be available?!

Hello,

I read that moving from one page to another normally destroys a
variable. The code below allows the variable "name" to be used in a
form on the second page. How does this happen? Or am I wrong?

Thanks

Geoff

I have put the whole code of the first page below - I can then use the
value of the name variable on the second page using IE v6. Now how is
that possible?!

Geoff

<HEAD>

<SCRIPT>

function prompter(button )

{

name=prompt('Wh at\'s your name?',"Please enter your first and
last name here, eg Jane Green");

alert("Welcome "+name + " Now read how to answer the
questions and then move to the questions");

document.getEle mentById('move' ).innerHTML =
"<button ID='move' onclick='moveto questions()'>Mo ve to
questions</button>";

if (button.parentN ode && button.parentNo de.removeChild)
{
button.parentNo de.removeChild( button);
}

}

function movetoquestions ()

{
window.location .href="second_p age.htm";
}

</SCRIPT>

</head>

<body>

<h2 align="center"> Tests</h2>

<pre>

</pre>

<p align="center"> <input type="button" value="Please give us your
name" onclick="prompt er(this)"></p>

<h3 align="center"> How to answer a typical question</h3>

etc etc

<SPAN ID="move"></SPAN>

</body>
</html>
Sep 28 '05 #1
2 1318

Geoff Cox wrote:
Hello,

I read that moving from one page to another normally destroys a
variable. The code below allows the variable "name" to be used in a
form on the second page. How does this happen? Or am I wrong?

Thanks

Geoff

I have put the whole code of the first page below - I can then use the
value of the name variable on the second page using IE v6. Now how is
that possible?!

Geoff

<HEAD>

<SCRIPT>

function prompter(button )

{

name=prompt('Wh at\'s your name?',"Please enter your first and
last name here, eg Jane Green");

alert("Welcome "+name + " Now read how to answer the
questions and then move to the questions");

document.getEle mentById('move' ).innerHTML =
"<button ID='move' onclick='moveto questions()'>Mo ve to
questions</button>";

if (button.parentN ode && button.parentNo de.removeChild)
{
button.parentNo de.removeChild( button);
}

}

function movetoquestions ()

{
window.location .href="second_p age.htm";
}

</SCRIPT>

</head>

<body>

<h2 align="center"> Tests</h2>

<pre>

</pre>

<p align="center"> <input type="button" value="Please give us your
name" onclick="prompt er(this)"></p>

<h3 align="center"> How to answer a typical question</h3>

etc etc

<SPAN ID="move"></SPAN>

</body>
</html>


Someone already answered this question in your last post:

Stephen Chalmers wrote:
'name' is effectively a reserved word as the variable window.name is
created automatically, but is not read-only.
Use more imaginative names for variables.

Sep 28 '05 #2
On 28 Sep 2005 01:27:40 -0700, "web.dev" <we********@gma il.com> wrote:

Someone already answered this question in your last post:

Stephen Chalmers wrote:
'name' is effectively a reserved word as the variable window.name is
created automatically, but is not read-only.
Use more imaginative names for variables.


web.dev

Thanks for above - oddly enough I cannot see that response in Agent
but can when I do a Google search.

Are you saying that the fact that window.name exists is the explantion
for why the name values are available in the second page?

Cheers

Geoff

Sep 28 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1893
by: SamMan | last post by:
I have a simple (I hope) question. Is it possible to pass a variable from a .js file to an .html file? A value is passed to the variable through a function, and I'd like to pass that variable on to an .html page. Thanks, Sam
1
3933
by: Gnarlodious | last post by:
I want to send a variable to a styleswitching script that will be a function of where the script is in the folder structure. The script will then assemble the stylesheet URL around the variable. For example, the variable "../../../../" would need to be sent to the script, how will I do this? Here is the script: http://www.Spectrumology.com/Styles/switcher.js
40
3048
by: Steve Juranich | last post by:
I know that this topic has the potential for blowing up in my face, but I can't help asking. I've been using Python since 1.5.1, so I'm not what you'd call a "n00b". I dutifully evangelize on the goodness of Python whenever I talk with fellow developers, but I always hit a snag when it comes to discussing the finer points of the execution model (specifically, exceptions). Without fail, when I start talking with some of the "old-timers"...
2
2611
by: R.G. Vervoort | last post by:
is it possible to declare a variable in the onchange event of a <select> and use it later in php I would like to put the value of the selected option (in <select>) in a variable and later when i activate a php function use this variable Looks inpossible but who knows maybe it is possible roy
134
7919
by: James A. Donald | last post by:
I am contemplating getting into Python, which is used by engineers I admire - google and Bram Cohen, but was horrified to read "no variable or argument declarations are necessary." Surely that means that if I misspell a variable name, my program will mysteriously fail to work with no error message. If you don't declare variables, you can inadvertently re-use an variable used in an enclosing context when you don't intend to, or
1
1243
by: TSW | last post by:
I am a fairly new programmer who is seeking some insight into variable scope and IIS. I have recently completed development on an ASP.Net application (VB.Net). In order to make certain variables available to all my subroutines I defined them as follows: Shared VariableName While this met my immediate need, it appears to be causing problems when several users are accessing my
8
1952
by: vvenk | last post by:
Hello: I just wrote my first ASP.Net application. It worked fine on my machine and when I put into production, the ASP.Net process reaches 50% quite fast and then the system does not work anymore until I kill that process. Obviously, this is not acceptable. Looking back, I do not destroy any objects in my form. Would that be the reasn why the application breaks down?
4
1941
by: comp.lang.php | last post by:
This is an urgent request (as always) generate_admin_customer_position_dropdown($customerResult, $customerResult->id); print_r($_SESSION); This code will generate an HTML dropdown as well as set a $_SESSION
10
9089
by: Dancefire | last post by:
Hi, everyone, I'm writing a program using wstring(wchar_t) as internal string. The problem is raised when I convert the multibyte char set string with different encoding to wstring(which is Unicode, UCS-2LE(BMP) in Win32, and UCS4 in Linux?). I have 2 ways to do the job:
1
25702
pbmods
by: pbmods | last post by:
VARIABLE SCOPE IN JAVASCRIPT LEVEL: BEGINNER/INTERMEDIATE (INTERMEDIATE STUFF IN ) PREREQS: VARIABLES First off, what the heck is 'scope' (the kind that doesn't help kill the germs that cause bad breath)? Scope describes the context in which a variable can be used. For example, if a variable's scope is a certain function, then that variable can only be used in that function. If you were to try to access that variable anywhere else in...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10459
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10187
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9055
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7553
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6795
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5578
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3735
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.