Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Updates Value from one window to another window

 
Angela Jessi
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Here is my question:
I have Parent html file , in which I want to open child file, hide child file and get the value from child file and send it to or update to parent html file. Also I can see updated value in Parent file when I click the button.
P.S.: When I open Parent file, i want to hide child.
How this is possible in Javascript.
Please let me know,
Thanks
Angela
 
bill bozeman
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't really end up hiding the window, you can't hide a browswer window like you can a frame in Java. You can, however, minimize the window or give the parent window focus, but this is not foolproof. If you have a call to give the parent window focus whenever someone tries to view the child window then what happens if someone closed the parent window? You would have to check for the existance of the parent window first or else get a javascript error. There is probably code the will allow you to minmize the window whenever someone tries to maximize it, but that would be really annoying to the user.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could probably do this with a frameset containing both the parent and child, and using the JavaScript to vary the relative sizes of the two frames. I've not done this, but it might be possible ...
 
Angela Jessi
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bill,Frank,
Thank a lot for your help. Let me try to embed two html pages in one frame and then if I can hide parent window and can update the value in child window.
Also, Is there method like window.hide() or hide.window or hide.Frame or html in Javascript?
Please let me know,
Thanks in advance,
Angela
 
bill bozeman
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good idea Frank. I have used that before with hiding the window. Have a frame with two html pages. Then have the code in the framset look like this:
<frameset rows="100%,*" border="0" frameborder="0">
Then the first html page will take up the whole window and the second one will be hidden. But you have have a lot of code in the second one. I did this when a client needed to have sound throughout the site, but they didn't want it to end and start again when you clicked through the site. So a hidden window had the sound file and I only updated the main page. Users don't really notice you are using frames because it takes up the whole page.
Bill
 
Angela Jessi
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bill,
I want to know the syntax you have used to hide one html and show only other html page in Frame.
Thanks
Angela
 
bill bozeman
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Angela, it is the code I provided above. You give the first page 100% and the next page will get the * which is everything else. Since the first one is 100%, the * becomes nothing and is hidden from view. It is still there, so if you have code or sound there you can still access it, but you just can't see it.
The code is:
<frameset rows="100%,*" border="0" frameborder="0">
 
Angela Jessi
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Here is my Index file:
<html>
<head>
<title>New Page 2</title>
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>
<frameset cols="150,*">
<frame name="contents"src="dim2.html">
<frame name="main" src="dim3.html">
</frameset>
</html>
Here is dim2.html:
<html>
<head>
<title>Testing to update values</title>
</head>
<SCRIPT LANGUAGE = JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
</script>
<body>
<CENTER>
<h1>Please Enter Value here</H1>
<FORM NAME="outputForm">
<INPUT TYPE=TEXT SIZE=20 NAME ="msgLine" VALUE="Hello There">
</FORM>
</CENTER>
</BODY>
</html>
Here is dim3.html:
<html>
<head>
<title>Testing to update values</title>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript">
if(top.location != self.location)
{
top.location=self.location
}
function updateValues(){
ip_421_value.innerHTML = parent.contents.outputForm.msgLine.value;
}
</SCRIPT>
<table border ="1">
<tr>
<td id = "printer_value"><div name="Printers">Printers</div></td>
<td id = "model_value"><div name="Models">Models</div></td>
<td id = "price_value"><div name="Price">Price</div></td>
</tr>
<tr>
<td id = "7040_value"><div name="7040">7040</div></td>
<td id = "ip_421_value"><div name="IP_421">IP-421</div></td>
<td id = "xxx_value"><div name="xxx">xxx</div></td>
</tr>
<tr>
<td id = "7050_value"><div name="7050">7050</div></td>
<td id = "IP-421J_value"><div name="IP-421J">IP-421J</div></td>
<td id = "yyy_value"><div name="yyy">yyy</div></td>
</tr>
<tr>
<td id = "7060_value"><div name="7060">7060</div></td>
<td id = "IP-601_value"><div name="IP-601">IP-601</div></td>
<td id = "zzz_value"><div name="zzz">zzz</div></td>
</tr>
</table>
<INPUT TYPE=BUTTON VALUE="Click me" NAME="BtnHello" OnClick="updateValues()">
</body>
</html>
I want to update the value of cell of dim3 from texbox value("Hellp There") of dim2.html file. when i try to run index file, I can hide dim2.html, but when I click on button of dim3.html to update the value of the cell from textbox of Dim2.html, I am getting this following error:
parent.content.outputForm is not an object.
Please help me out,
Thanks
Angela
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic