472,805 Members | 952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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 1567
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+shift>
...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.com/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********@odah37.prod.google.com>,
"learner" <v_********@yahoo.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
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,...
3
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...
1
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...
5
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> .......
1
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...
26
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...
1
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...
24
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...
5
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...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.