-
<input type="button" name="abc" value=" Copy 2 Clipboard" onclick="window.top.value=this.value;" />
-
<a href="test.html" target="_blank">Open a new window!!!!</a>
-
<input type="text" name="abc1" value="" onclick="this.value=typeof window.top.value!='undefined'?window.top.value:'';"/>
-
Now i m opening the same page at a different window.
There if i click on the text box then i m getting the undefined value of top.value
Why it's happening?
can't i get the [b]top.value[b] from any children window of that top window?
Where i am wrong?
Debasis Jana.
13 3113
I changed my code to ....
I have my two source codes.
those are given below! -
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
<html xmlns="http://www.w3.org/1999/xhtml">
-
<head>
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-
<title>Simple Test</title>
-
<script type="text/javascript">
-
window.top.test_value = null;
-
function test_abc(){
-
window.top.test_value = "Debasis Jana....!!!!";
-
alert(window.top.test_value);
-
}
-
-
function getTopVal(){
-
var tmp = window;
-
while(tmp.opener){
-
tmp = tmp.opener;
-
}
-
alert(tmp.top.value);
-
}
-
</script>
-
</head>
-
<body">
-
<input type="button" name="abc" value=" Copy 2 Clipboard" onclick="window.top.value=this.value;" />
-
<a href="test1.html" target="_blank">Open a new window!!!!</a>
-
<input type="text" name="abc1" value="" onclick="getTopVal();"/>
-
</body>
-
</html>
-
-
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
<html xmlns="http://www.w3.org/1999/xhtml">
-
<head>
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-
<script type="text/javascript">
-
function getTopVal(){
-
var tmp = window;
-
while(tmp.opener){
-
tmp = tmp.opener;
-
}
-
alert(tmp.top.value);
-
}
-
</script>
-
<title>Test!!!</title>
-
</head>
-
-
<body>
-
<input type="text" name="abc2" value="" onclick="getTopVal();"/>
-
</body>
-
</html>
-
-
Now it's working as i expected!
:-)
What is this window.top.value?
Never heard about this.
Not sure what you were trying to do. window.top usually refers to the top frame. If you wanted to set a value, you could have set a global variable.
Not sure what you were trying to do. window.top usually refers to the top frame. If you wanted to set a value, you could have set a global variable.
See what i am trying to do i want to save a value some where and i want to make available this value to any children window of that window.
So i thought it's better to save in top window's reference.
Anyway i can also save in that window's reference.
Anyway by this experiment i came to know the actual reality of top. :-)
Debasis Jana
Yes, window.test_value would have been enough. Then from the child windows, window.opener.test_value should give you the value you need.
Yes, window.test_value would have been enough. Then from the child windows, window.opener.test_value should give you the value you need.
Yeah that also be fine. :-)
Thanks Acoder!
No problem. You're welcome :)
No problem. You're welcome :)
Thanks again!!
Sorry Acoder I forgot to mention one thing that in my case there is no way rather than using top.
Actually i want to save the value from a window which can be at any frame of the main window. And the child window may be from another frame of the main window.
So here is only option is top.
Debasis Jana.
In that case, you could use window.top.test_value or top.opener.top.test_value (for frame in a popup window).
In that case, you could use window.top.test_value or top.opener.top.test_value (for frame in a popup window).
Yeah that's what i m using top ..and i already found the solution.
i am using this function to find out that value. -
function getTopVal(){
-
var tmp = window;
-
while(tmp.opener){
-
tmp = tmp.opener;
-
}
-
alert(tmp.top.value);
-
}
-
Anyway, Thanks for your help!
Yeah, I did see that, but I would avoid "value" because it can be confusing.
Yeah, I did see that, but I would avoid "value" because it can be confusing.
Ohh...!!!
That's what you were saying.....test_value.
lolz!
Debasis Jana
Yes, exactly! We finally got there ;)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Bruce Davis |
last post by:
I'm having a problem on windows (both 2000 and XP) with a multi-threaded
tkinter gui application. The problem appears to be a deadlock condition
when a child thread pops up a
Pmw dialog window in...
|
by: Bonj |
last post by:
Hello
Can anyone assist with the following class hierarcy problem?
I have a series of window classes, the object model currently being as such:
Window
/ | \
/ | \...
|
by: David McCulloch |
last post by:
The following code opens a new window, but the "resizeTo" doesn't resize it.
Why not?
(Don't ask why I simply did not open the window with the new size....my
original problem was how to open a...
|
by: Tyrone Slothrop |
last post by:
The first question, is this even possible?
What I need to do is pass the contents of a PHP web page from a
textarea using window.open method to a new browser window and display
it. The page has...
|
by: VR |
last post by:
First, greetings to everyone :)
I'm doing a university seminar & I've encountered a problem. I have a
gallery with thumbnails linked on pictures. What I want is popup to be
opened with...
|
by: Christian Kaiser |
last post by:
We have a component that has no window. Well, no window in managed code - it
uses a DLL which itself uses a window, and this is our problem!
When the garbage collector runs and removes our...
|
by: Jan Tovgaard |
last post by:
Hey everyone:)
We have a critical problem, which I can see that other people also has ran
into.
In Internet Explorer 7 it is no longer possible to do a window.close after
opening a window,...
|
by: rsteph |
last post by:
I bought a book to help me learn to use DirectX with windows programming. It's first trying to walk me through some basic windows programming and graphics before getting into DirectX. I'm trying to...
|
by: davidson1 |
last post by:
Hai friends..for menu to use in my website..i found in one website....pl look below website....
http://www.dynamicdrive.com/dynamicindex1/omnislide/index.htm
i downloaded 2 files....
...
|
by: swethak |
last post by:
Hi,
I am getting the problem the problem with google map in Internet Explorer. This map worked fine in mozilla . When i opened the same map in Internet Explorer i am getting the error...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
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...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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...
| |