473,769 Members | 5,518 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Urgent!!Global window reference!!

Hi,
In a page, i have many links.
I have some functions in a global file which is included in all
linked pages.
I want to have a reference to a window which is to be opened on
clicking one link and it should be known only to one more link on that
page and not to other links.
I cant have that window reference in that global file, since iam
declaring it initially as Null and modifying its value in that one
particular link. Since all links include this global file they change
the refernce to Null and its value is lost.
What can i do for this?

Plz let me know the earliest..

Jul 23 '05 #1
2 1636
On 30 Aug 2004 01:36:22 -0700, learner wrote:
Urgent!!Global window reference!!
a) Please give your ..
<http://www.physci.org/kbd.jsp?key=1+s hift>
...key a rest
Plz let me know the earliest..


b) Please do not come in here screaming
'Urgent' and asking to be told 'the earliest'..
Your question will be asnswered as soon (and if)
someone feels like it.

c) Please note this is not your personal 24Hr
Help desk, it is acctually a discussion forum,
as expounded in the FAQ..

d) You, ..have *checked* the FAQ, haven't you?
<http://www.jibbering.c om/faq>

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 23 '05 #2
In article <cg********@oda h37.prod.google .com>,
"learner" <v_********@yah oo.com> wrote:
Hi,
In a page, i have many links.
I have some functions in a global file which is included in all
linked pages.
I want to have a reference to a window which is to be opened on
clicking one link and it should be known only to one more link on that
page and not to other links.
Are you using the HTML anchor tag <a> ?

In that case, Evertjan, The Netherlands, answered your question in the
prior post.
I cant have that window reference in that global file, since iam
declaring it initially as Null and modifying its value in that one
particular link. Since all links include this global file they change
the refernce to Null and its value is lost.
The web browser has the responsibility for security and that is a good
thing. The web browser controls the access to variables in a more
absolute manor than you see in c/c++.

How are you getting the window reference? The word link implies you are
using the anchor tag. The words window reference implies that you are
using the window.open function.

Lets say you had files a.html, b.html, and c.html all in the same
directory. Lets say you did this in file a.html:
var myData; // written outside of any function

window.open('b. html',...)
window.open('c. html',...)

Javascript functions in both b.html and c.html would be able to access
variable myData by coding:
opener.myData

You will note that functions in b.html and c.html do not have to declare
opener.myData.

Browser security will require files a.html, b.html, and c.html to all be
in the same directory unless you relax the default security settings.
What can i do for this?


I am not certain what your goal is. Are you trying to employ good
programming practices? Are you trying to encapsulate the data?

A web application can be very big. The nature of the web forces a
decentralized coding style. You will not see the monolithic programs you
find with c/c++ programs. In c/c++, you have to worry more about data
encapsulation. On the web, I think you will find the pieces are smaller.
The web forces you to write decentralized programs. You may feel more
comfortable using global variables in Javascript because there scope is
smaller in the overall picture of your application.

You can use closure to encapsulate your variables if you wish.
See:http://jibbering.com/faq/faq_notes/closures.
I think you need to redesign your application.

Robert
Jul 23 '05 #3

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

Similar topics

2
16902
by: N/A | last post by:
Hey all, If I open a popup like this window.open('http://www.google.com', 'popup', 'width = 618, height = 425, directories = no, location = no, menubar = no, resizable = no, scrollbars = yes, status = no, toolbar = no'); Then I know that there is a window object in the windows collection called 'popup'. So how can I make that window come to the front? Looking for
3
20612
by: Jonan | last post by:
Hi, I use JavaScript I have tree windows. Jonan1.html has this code erref1=window.open("Jonan2.html", "mypage",null); This opens Jonan2.html and it has this code erref=window.showModalDialog("Dialogo.html", null); This opens Dialogo.html How can I do to close Jonan2.html and Dialogo.html from Jonan1.html How can I get the Dialogo.html reference from Jonan1.html.
1
1345
by: laxmi | last post by:
Is there a way to test whether a named window is open from a separate window which may not have opened the window? I have tried using: if(windowname == null) win = window.open(...) This gives an error that windowname is undefined if(window.windowname) doesn't work either (no error, but fails to
5
31226
by: Derek Erb | last post by:
I am banging my head against the wall with this one. The following code snippets work perfectly fine in MSIE6. But produce an error in Firefox and do not work at all. BROWSER.HTM <HTML> .... <div class="Abb"> <h2 id="ABTit">BROWSER</h2> </div>
1
5578
by: Rudy | last post by:
Hi Is there a way is a 'class library' to get the reference to window of application that uses the library ? I'm using class library to create a custom command for a closed source application (GeoMedia), so obviously I can't make it to pass this reference to my lib as a method parameter. -- Rudy
26
5694
by: yb | last post by:
Hi, Is there a standard for the global 'window' object in browsers? For example, it supports methods such as setInterval and clearInterval, and several others. I know that w3c standardized several parts of the DOM, but this does not include the window object. Thank you
1
1088
by: yotaxp | last post by:
Alright, I'll try and word this as clearly as possible. Let's say my application (APP) is capable of opening browser windows (WIN1 and WIN2). Once open, the browser windows are capable of freely sending text data to the APP. What I am trying to do is to give WIN2 a reference to WIN1 using mere text strings. Before WIN2 opens, WIN1 has the opportunity to send the APP information about itself (again, in the form of text). Is there any...
24
8227
by: Jeremy J Starcher | last post by:
While reading c.l.j, I've noticed that some people prefer and indeed even recommend the use of "window.alert()" over "alert()". I can't find any technical reason to make this distinction, and seems to have a (tiny) amount overhead since window itself points to the global object, hence, a circular reference. (From everything I am reading, window is just a REFERENCE back to the global object, as opposed to a separate object.)
5
10300
by: aelred | last post by:
I have a web page where a member can open up a chat window (child window) with another member. - From there the member can also navigate to other web pages. - From other pages in the site, they may also open up new chat windows with other members (just not the same one). - Each chat page is opened with the member name as the window name. - When I log off from the web page, I would like all the chat windows to automatically close. I...
0
9589
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
10211
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...
0
8872
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
7409
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
5299
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3959
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
3562
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.