473,410 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

two script pages

I initialize a variable named cpag = 'recommend this page'

in another external script page I will use: cpv = cpag

But it does not work, only if cpag is initialize on the same page as
cpv = cpag.

???
Aug 9 '07 #1
2 1187
Find Clausen wrote:
I initialize a variable named cpag = 'recommend this page'

in another external script page I will use: cpv = cpag

But it does not work, only if cpag is initialize on the same page as
cpv = cpag.

???
Hi,

If I understand you well, you make a variable on one page in js, and
wonder why it is not on the next page. Is that right?

If so: ALL variables have a scope of 1 page: the page they live in.
When the page reloads, or is replaced, you loose all your js variables.
And that is good.
Imagine your browser should keep track of all variables that ever
existed in js....

If you want to pass a variable around, you have several options.

1) cookie
Set a cookie. This only works if the pages are in the same domain.

2) pass around via GET in the URL, like this in a hyperlink:
<a
href="http://www.example.com/yourscript.html?cpag=recommend%20this%20page">Visi t
another page</a>

That works to every page, also outside your domain.
yourscript.html can now extract the value of cpag out of the url.

And a few more options, but these 2 are the most simple to implement I
expect.

Regards,
Erwin Moller
Aug 10 '07 #2
On Fri, 10 Aug 2007 13:35:59 +0200, Erwin Moller
<Si******************************************@spam yourself.comwrote:
If I understand you well, you make a variable on one page in js, and
wonder why it is not on the next page. Is that right?
No, it's not like that:

It's like in the tread:
Including one external JS file directly into another ...

just two-three variable form the main file would not be "assigned" in
the included file.

But I have now moved it all to the language file, so no sweat :-)

Aug 10 '07 #3

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

Similar topics

8
by: Sticks | last post by:
ok... im not quite sure how to describe my problem. i have a php script that runs through my entire php site and writes the resulting output to html files. this is necessary as the nature of the...
14
by: Dafydd | last post by:
I have the following Script in my web page reduce to two pages. <script> function details() { document.getElementById('details').style.visibility='visible';...
7
by: Erwin Moller | last post by:
Hi group, I am a bit cconfused with the different tags I encounter to start a script. I used to use: language="Javascript" Nowadays I use: type="text/javascript" I did see some...
0
by: Mike G | last post by:
Hi - I support a web application that contains many ASP's. Periodically, the DLLHOST.EXE running this app (we have it in High protection) will start taking alot of time (consistently between 30...
14
by: Pascal Damian | last post by:
My HTML pages have a <SCRIPT SRC=http://remote/script> at the top'ish of each page. Sometimes the remote host (probably due to heavy load or flaky network connectivity) doesn't respond for a long...
1
by: Russ | last post by:
I've been trying to get my head around this for 3 days now and it seems like everything I try does not work for one reason or another. I built a test page using the TabStrip and MultiPage controls....
2
by: Susanne West | last post by:
hi group. i'm tackling a bigger project that will use mod_rewrite to patch a series of urls into a master php-script. this script builds the page framework that contains a series of elements...
2
by: m19peters | last post by:
We have a script that I had to rework a little bit for 2005 that does a full backup for every database on the server... For some reason on some nights the script does not backup all databases......
1
by: michael.buonomo | last post by:
We have been using the Google recommended python script for about a year. We recently realized that the script was not crawling our sites url's, but just our folders which reside on the server. The...
10
manuelgk
by: manuelgk | last post by:
Hello everybody, yesterday I had a problem with a script that I developed about 2 months ago. The goal of this script is to detect the click events in the links contained in Web pages and, when...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...

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.