473,397 Members | 2,077 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,397 software developers and data experts.

control new window

Hello, i'm looking for a javascript solution to the following problem:

I have two pages: list.php and update.php

on list.php page, i have a hyperlink to update.php page (open a new window). when user click update button on update.php, i want to update mysql table, automatically close update.php page and refresh list.php page.

anyone got any suggestion for this. thank you so much.

t. hiep

Dec 28 '07 #1
7 1397
And you also need to check to make sure the opener has not been closed
by the user.

Maybe if(window.opener) But not 100% sure about that last part.

Dec 28 '07 #2
i'm clueless on what you explained. *i'm a newbie to java. *thanks.
>
t. hiep

Ok. Well it is Javascript not to be confused with java. However, it is
really not all that complicated.

I assume that your update.php is like a pop up window.

The following demonstrates a little of what you are looking for. It
should put you on the right path.

In the parent window (list.php for you)

<html>
<head>
<script>
function doStuff(msg){
alert("here is a message from the child window: " + msg);
}
</script>
</head>

<body>

<input type="button" value="click me"
onclick="window.open('kiddoc.html','kidwin','width =300,height=300')" /
>

</body>

</html>

In the child window which I named kiddoc.html, (but is update.php in
your case)

<html>
<head>
<script>

function sendStuff(){
window.opener.doStuff('hi there');
window.close();
}
</script>
</head>

<body>
<input type="button" value="now click on this" onclick="sendStuff()" /
>
</body>
</html>

You can cut and paste this into two docs on your desktop, just name
the child window kiddoc.html, and this will work.

Good luck.
Dec 28 '07 #3
Hiep Nguyen said:
[snip]
>
i'm clueless on what you explained. i'm a newbie to java. thanks.

t. hiep

Trouble is, that's the answer. Here you go:
http://tinyurl.com/2hdc3e
That -^ is a link to a google search for "window.opener". Have fun.

~A!

--
Anthony Levensalor
an*****@mypetprogrammer.com

Only two things are infinite, the universe and human stupidity,
and I'm not sure about the former. - Albert Einstein
Dec 28 '07 #4
"Doug Gunnoe" <do********@gmail.comwrote in message
news:7a**********************************@s12g2000 prg.googlegroups.com...
i'm clueless on what you explained. i'm a newbie to java. thanks.

t. hiep

Ok. Well it is Javascript not to be confused with java. However, it is
really not all that complicated.

I assume that your update.php is like a pop up window.

The following demonstrates a little of what you are looking for. It
should put you on the right path.

In the parent window (list.php for you)

<html>
<head>
<script>
function doStuff(msg){
alert("here is a message from the child window: " + msg);
}
</script>
</head>

<body>

<input type="button" value="click me"
onclick="window.open('kiddoc.html','kidwin','width =300,height=300')" /
>

</body>

</html>

In the child window which I named kiddoc.html, (but is update.php in
your case)

<html>
<head>
<script>

function sendStuff(){
window.opener.doStuff('hi there');
window.close();
}
</script>
</head>

<body>
<input type="button" value="now click on this" onclick="sendStuff()" /
>
</body>
</html>

You can cut and paste this into two docs on your desktop, just name
the child window kiddoc.html, and this will work.

Good luck.

thanks. i'll give it a try.
t. hiep
Dec 28 '07 #5
"Hiep Nguyen" <hn*****@jadesterling.comwrote in message
news:4a***************************@NLS.NET...
"Doug Gunnoe" <do********@gmail.comwrote in message
news:7a**********************************@s12g2000 prg.googlegroups.com...
>i'm clueless on what you explained. i'm a newbie to java. thanks.

t. hiep


Ok. Well it is Javascript not to be confused with java. However, it is
really not all that complicated.

I assume that your update.php is like a pop up window.

The following demonstrates a little of what you are looking for. It
should put you on the right path.

In the parent window (list.php for you)

<html>
<head>
<script>
function doStuff(msg){
alert("here is a message from the child window: " + msg);
}
</script>
</head>

<body>

<input type="button" value="click me"
onclick="window.open('kiddoc.html','kidwin','width =300,height=300')" /
>>
can i use <a hreftag instead of <input type="button"above? If yes, can
you show how? I try different ways, but not successful. thanks
>

</body>

</html>

In the child window which I named kiddoc.html, (but is update.php in
your case)

<html>
<head>
<script>

function sendStuff(){
window.opener.doStuff('hi there');
window.close();
}
</script>
</head>

<body>
<input type="button" value="now click on this" onclick="sendStuff()" /
>>
</body>
</html>

You can cut and paste this into two docs on your desktop, just name
the child window kiddoc.html, and this will work.

Good luck.

thanks. i'll give it a try.
t. hiep

Dec 31 '07 #6
"Hiep Nguyen" <hn*****@jadesterling.comwrote in message
news:4a***************************@NLS.NET...
"Doug Gunnoe" <do********@gmail.comwrote in message
news:7a**********************************@s12g2000 prg.googlegroups.com...
>i'm clueless on what you explained. i'm a newbie to java. thanks.

t. hiep


Ok. Well it is Javascript not to be confused with java. However, it is
really not all that complicated.

I assume that your update.php is like a pop up window.

The following demonstrates a little of what you are looking for. It
should put you on the right path.

In the parent window (list.php for you)

<html>
<head>
<script>
function doStuff(msg){
alert("here is a message from the child window: " + msg);
}
</script>
</head>

<body>

<input type="button" value="click me"
onclick="window.open('kiddoc.html','kidwin','width =300,height=300')" /
>>


</body>

</html>

In the child window which I named kiddoc.html, (but is update.php in
your case)

<html>
<head>
<script>

function sendStuff(){
window.opener.doStuff('hi there');
window.close();
}
</script>
</head>

<body>
<input type="button" value="now click on this" onclick="sendStuff()" /
>>
</body>
</html>

You can cut and paste this into two docs on your desktop, just name
the child window kiddoc.html, and this will work.

Good luck.

thanks. i'll give it a try.
t. hiep
i got it works now, but i need to refresh list.php page right before
window.close().
I tried window.opener.reload(true), but it doesn't work. any idea how to
refresh the parent window before window.close(). thanks.
Dec 31 '07 #7
"Doug Gunnoe" <do********@gmail.comwrote in message
news:7a**********************************@s12g2000 prg.googlegroups.com...
i'm clueless on what you explained. i'm a newbie to java. thanks.

t. hiep

Ok. Well it is Javascript not to be confused with java. However, it is
really not all that complicated.

I assume that your update.php is like a pop up window.

The following demonstrates a little of what you are looking for. It
should put you on the right path.

In the parent window (list.php for you)

<html>
<head>
<script>
function doStuff(msg){
alert("here is a message from the child window: " + msg);
}
</script>
</head>

<body>

<input type="button" value="click me"
onclick="window.open('kiddoc.html','kidwin','width =300,height=300')" /
>

</body>

</html>

In the child window which I named kiddoc.html, (but is update.php in
your case)

<html>
<head>
<script>

function sendStuff(){
window.opener.doStuff('hi there');
window.close();
}
</script>
</head>

<body>
<input type="button" value="now click on this" onclick="sendStuff()" /
>
</body>
</html>

You can cut and paste this into two docs on your desktop, just name
the child window kiddoc.html, and this will work.

Good luck.
i think i know the problem. how do i force list.php reload after update.php
page updated mysql table? in other word, after user clicked update button
on update.php page, this page will update the record in mysql table then
reload list.php page. is this possible at all? or do i need to find a
different way to update my table???

thanks
Dec 31 '07 #8

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

Similar topics

1
by: Noozer | last post by:
When using the WebBrowser control, is it possible to cause popup windows to appear within the WebBrowser control itself instead of a new window? This is what I've written in the NewWindow2 event,...
2
by: zapazap | last post by:
Dear Snake Charming Gurus, (Was: http://mail.python.org/pipermail/python-list/2004-January/204454.html) First, a thank you to Tim Golden, Thomas Heller, and Mark Hammond for your earlier help...
1
by: Vetrivel | last post by:
Application architecture : Develop interface between two existing systems, a. Enterprise CRM system b. Web based intranet system. Environment : Intranet Server : IIS and ASP. Script :...
10
by: fotzor | last post by:
Hi, I'm a C++-Programmer and want to subclass the Edit used to write a SQL-Query in Access. The edit is of the special Access class OKttbx. Everything works, I injected a DLL into the...
9
by: David Sworder | last post by:
Hi, I have a form that displays data (is that vague enough for you?). The data comes in on a thread-pool thread. Since the thread pool thread is not the same as the UI thread, the callback...
2
by: Tom Shelton | last post by:
I was goofing around tonight and decided to write a little IP address control. I had written a simple one a long time ago, but I decided I should try to write one that was half way correct :) ...
0
by: Anonieko | last post by:
Are there any javascript codes there? Answer: Yes On the PageLoad event call InitialClientControsl as follows /// <summary> /// This will add client-side event handlers for most of the...
3
by: Joseph Gruber | last post by:
Hi all -- I have two questions. First, I'm adding a control to my form at runtime and the control/form seems to ignore the anchor property of the runtime control. Any idea how I can get a...
18
by: jim | last post by:
OK...Don't ask why - it'll just make ya mad. It makes me mad just thinking about it. I swear....if I didn't need this job, I'd tell 'em where to embed their webbrowser control. But, since I do...
5
by: colin | last post by:
Hi, Ive got a 3d model editor wich im developing with XNA c# development environment, using the game window to display the wireframe mesh in 3d. however I need to use some other windows too,...
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: 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...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.