Hi I have 2 functions in java script, one opens a second window-this works,
the other is supposed to close this second window, does not seem to be
working. Just wondering if anyone had any ideas.
Here is the code,
the functions are
<script language="javas cript">
function openwin(){
win_usr=window. open ("control_numin fo.aspx")
}
function closewin(){
win_usr.close() ;
}
</script>
below is how I am trying to call the functions,
<script language="javas cript" event="onclick( )" for="btn_user">
openwin();
</script>
<script language="javas cript" event="onclick( )" for="btn_clear" >
closewin();
</script>
</form>
thanks,
--
Paul G
Software engineer. 14 2762
the code is ok, but if the open button click fires a postback, or a postback
is done before you call close it will not work, as you will have lost the
window handle.
-- bruce (sqlwork.com)
"Paul" <Pa**@discussio ns.microsoft.co m> wrote in message
news:0A******** *************** ***********@mic rosoft.com...
| Hi I have 2 functions in java script, one opens a second window-this
works,
| the other is supposed to close this second window, does not seem to be
| working. Just wondering if anyone had any ideas.
| Here is the code,
| the functions are
| <script language="javas cript">
| function openwin(){
| win_usr=window. open ("control_numin fo.aspx")
| }
| function closewin(){
| win_usr.close() ;
| }
| </script>
| below is how I am trying to call the functions,
| <script language="javas cript" event="onclick( )" for="btn_user">
| openwin();
| </script>
| <script language="javas cript" event="onclick( )" for="btn_clear" >
| closewin();
| </script>
| </form>
| thanks,
| --
| Paul G
| Software engineer.
I've written sample code and tested it in IE6, and it works.
<html>
<head>
<script language="javas cript">
function openwin(){
win_usr=window. open ("control_numin fo.aspx")
}
function closewin(){
win_usr.close() ;
}
</script>
<script language="javas cript" event="onclick( )" for="btn_user">
openwin();
</script>
<script language="javas cript" event="onclick( )" for="btn_clear" >
closewin();
</script>
</head>
<body>
<form runat=server>
<input id="btn_user" type="button">
<input id="btn_clear" type="button">
</form>
</body>
</html>
However it's not going to be work in Mozilla based browsers such as Mozilla,
Netscape and Firefox.
For reference on how to do it, see here: http://wdvl.com/Authoring/JavaScript...turing_ns.html
Also, make sure your button do NOT have "runat = 'server'" attribute.
"Paul" <Pa**@discussio ns.microsoft.co m> ¦b¶l¥ó
news:0A******** *************** ***********@mic rosoft.com ¤¤¼¶¼g... Hi I have 2 functions in java script, one opens a second window-this
works, the other is supposed to close this second window, does not seem to be working. Just wondering if anyone had any ideas. Here is the code, the functions are <script language="javas cript"> function openwin(){ win_usr=window. open ("control_numin fo.aspx") } function closewin(){ win_usr.close() ; } </script> below is how I am trying to call the functions, <script language="javas cript" event="onclick( )" for="btn_user"> openwin(); </script> <script language="javas cript" event="onclick( )" for="btn_clear" > closewin(); </script> </form> thanks, -- Paul G Software engineer.
ok thanks for the information, could be that a postback is happening so
loosing the handle. Guess one could save the handle in a session
variable,not quite sure how this would work.
"bruce barker" wrote: the code is ok, but if the open button click fires a postback, or a postback is done before you call close it will not work, as you will have lost the window handle.
-- bruce (sqlwork.com)
"Paul" <Pa**@discussio ns.microsoft.co m> wrote in message news:0A******** *************** ***********@mic rosoft.com... | Hi I have 2 functions in java script, one opens a second window-this works, | the other is supposed to close this second window, does not seem to be | working. Just wondering if anyone had any ideas. | Here is the code, | the functions are | <script language="javas cript"> | function openwin(){ | win_usr=window. open ("control_numin fo.aspx") | } | function closewin(){ | win_usr.close() ; | } | </script> | below is how I am trying to call the functions, | <script language="javas cript" event="onclick( )" for="btn_user"> | openwin(); | </script> | <script language="javas cript" event="onclick( )" for="btn_clear" > | closewin(); | </script> | </form> | thanks, | -- | Paul G | Software engineer.
ok thanks for the information
"Lau Lei Cheong" wrote: I've written sample code and tested it in IE6, and it works. <html> <head> <script language="javas cript"> function openwin(){ win_usr=window. open ("control_numin fo.aspx") } function closewin(){ win_usr.close() ; } </script> <script language="javas cript" event="onclick( )" for="btn_user"> openwin(); </script> <script language="javas cript" event="onclick( )" for="btn_clear" > closewin(); </script> </head> <body> <form runat=server> <input id="btn_user" type="button"> <input id="btn_clear" type="button"> </form> </body> </html>
However it's not going to be work in Mozilla based browsers such as Mozilla, Netscape and Firefox. For reference on how to do it, see here: http://wdvl.com/Authoring/JavaScript...turing_ns.html
Also, make sure your button do NOT have "runat = 'server'" attribute.
"Paul" <Pa**@discussio ns.microsoft.co m> ¦b¶l¥ó news:0A******** *************** ***********@mic rosoft.com ¤¤¼¶¼g... Hi I have 2 functions in java script, one opens a second window-this works, the other is supposed to close this second window, does not seem to be working. Just wondering if anyone had any ideas. Here is the code, the functions are <script language="javas cript"> function openwin(){ win_usr=window. open ("control_numin fo.aspx") } function closewin(){ win_usr.close() ; } </script> below is how I am trying to call the functions, <script language="javas cript" event="onclick( )" for="btn_user"> openwin(); </script> <script language="javas cript" event="onclick( )" for="btn_clear" > closewin(); </script> </form> thanks, -- Paul G Software engineer.
Hi I tried the code and it worked but when I use .NET to add the buttons and
take out the run at server attribute the button does not even show up on the
form.
See below
<asp:Button id="btn_user" style="Z-INDEX: 101; LEFT: 152px; POSITION:
absolute; TOP: 80px" Text="Open" CausesValidatio n="False"></asp:Button>
Just wondering if there is another attribute I should add in place of the
runat server.
"Lau Lei Cheong" wrote: I've written sample code and tested it in IE6, and it works. <html> <head> <script language="javas cript"> function openwin(){ win_usr=window. open ("control_numin fo.aspx") } function closewin(){ win_usr.close() ; } </script> <script language="javas cript" event="onclick( )" for="btn_user"> openwin(); </script> <script language="javas cript" event="onclick( )" for="btn_clear" > closewin(); </script> </head> <body> <form runat=server> <input id="btn_user" type="button"> <input id="btn_clear" type="button"> </form> </body> </html>
However it's not going to be work in Mozilla based browsers such as Mozilla, Netscape and Firefox. For reference on how to do it, see here: http://wdvl.com/Authoring/JavaScript...turing_ns.html
Also, make sure your button do NOT have "runat = 'server'" attribute.
"Paul" <Pa**@discussio ns.microsoft.co m> ¦b¶l¥ó news:0A******** *************** ***********@mic rosoft.com ¤¤¼¶¼g... Hi I have 2 functions in java script, one opens a second window-this works, the other is supposed to close this second window, does not seem to be working. Just wondering if anyone had any ideas. Here is the code, the functions are <script language="javas cript"> function openwin(){ win_usr=window. open ("control_numin fo.aspx") } function closewin(){ win_usr.close() ; } </script> below is how I am trying to call the functions, <script language="javas cript" event="onclick( )" for="btn_user"> openwin(); </script> <script language="javas cript" event="onclick( )" for="btn_clear" > closewin(); </script> </form> thanks, -- Paul G Software engineer.
A PostBack is certainly going to lose the handle. You realize that each Page
instance is occurring in a vacuum, don't you? When the page reloads into the
browser, everything is new.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
"Paul" <Pa**@discussio ns.microsoft.co m> wrote in message
news:21******** *************** ***********@mic rosoft.com... ok thanks for the information, could be that a postback is happening so loosing the handle. Guess one could save the handle in a session variable,not quite sure how this would work.
"bruce barker" wrote:
the code is ok, but if the open button click fires a postback, or a
postback is done before you call close it will not work, as you will have lost
the window handle.
-- bruce (sqlwork.com)
"Paul" <Pa**@discussio ns.microsoft.co m> wrote in message news:0A******** *************** ***********@mic rosoft.com... | Hi I have 2 functions in java script, one opens a second window-this works, | the other is supposed to close this second window, does not seem to be | working. Just wondering if anyone had any ideas. | Here is the code, | the functions are | <script language="javas cript"> | function openwin(){ | win_usr=window. open ("control_numin fo.aspx") | } | function closewin(){ | win_usr.close() ; | } | </script> | below is how I am trying to call the functions, | <script language="javas cript" event="onclick( )" for="btn_user"> | openwin(); | </script> | <script language="javas cript" event="onclick( )" for="btn_clear" > | closewin(); | </script> | </form> | thanks, | -- | Paul G | Software engineer.
Hi thanks for the response. Yes everything is new as you mentioned. I was
able to get it working by using the <input statement for the button that
opens the child window, does not cause a post back. I have another window
that has a column of buttons in a data grid and when these buttons are
selected, it opens a child window. Guess in this case it is posting back to
the server so will have to some how save off the handle name and then
retreive it and use it in the onunload event of the parent window in the body
tag, so when the parent window navigates away the child window if left open
will be closed.
"Kevin Spencer" wrote: A PostBack is certainly going to lose the handle. You realize that each Page instance is occurring in a vacuum, don't you? When the page reloads into the browser, everything is new.
-- HTH, Kevin Spencer ..Net Developer Microsoft MVP Neither a follower nor a lender be.
"Paul" <Pa**@discussio ns.microsoft.co m> wrote in message news:21******** *************** ***********@mic rosoft.com... ok thanks for the information, could be that a postback is happening so loosing the handle. Guess one could save the handle in a session variable,not quite sure how this would work.
"bruce barker" wrote:
the code is ok, but if the open button click fires a postback, or a postback is done before you call close it will not work, as you will have lost the window handle.
-- bruce (sqlwork.com)
"Paul" <Pa**@discussio ns.microsoft.co m> wrote in message news:0A******** *************** ***********@mic rosoft.com... | Hi I have 2 functions in java script, one opens a second window-this works, | the other is supposed to close this second window, does not seem to be | working. Just wondering if anyone had any ideas. | Here is the code, | the functions are | <script language="javas cript"> | function openwin(){ | win_usr=window. open ("control_numin fo.aspx") | } | function closewin(){ | win_usr.close() ; | } | </script> | below is how I am trying to call the functions, | <script language="javas cript" event="onclick( )" for="btn_user"> | openwin(); | </script> | <script language="javas cript" event="onclick( )" for="btn_clear" > | closewin(); | </script> | </form> | thanks, | -- | Paul G | Software engineer.
Just had an additional question, below is what I have that opens a child
window(created by .NET for a hyperlink data column grid),
is there a way to assign a handle to this so I can build a close function
and call it when the parent window unloads?
<asp:HyperLinkC olumn Text="View" Target="_blank"
DataNavigateUrl Field="Data_Ite m_ID"
DataNavigateUrl FormatString="c hild.aspx?i_Dat a_Item_ID={0}"
thanks Paul.
"Kevin Spencer" wrote: A PostBack is certainly going to lose the handle. You realize that each Page instance is occurring in a vacuum, don't you? When the page reloads into the browser, everything is new.
-- HTH, Kevin Spencer ..Net Developer Microsoft MVP Neither a follower nor a lender be.
"Paul" <Pa**@discussio ns.microsoft.co m> wrote in message news:21******** *************** ***********@mic rosoft.com... ok thanks for the information, could be that a postback is happening so loosing the handle. Guess one could save the handle in a session variable,not quite sure how this would work.
"bruce barker" wrote:
the code is ok, but if the open button click fires a postback, or a postback is done before you call close it will not work, as you will have lost the window handle.
-- bruce (sqlwork.com)
"Paul" <Pa**@discussio ns.microsoft.co m> wrote in message news:0A******** *************** ***********@mic rosoft.com... | Hi I have 2 functions in java script, one opens a second window-this works, | the other is supposed to close this second window, does not seem to be | working. Just wondering if anyone had any ideas. | Here is the code, | the functions are | <script language="javas cript"> | function openwin(){ | win_usr=window. open ("control_numin fo.aspx") | } | function closewin(){ | win_usr.close() ; | } | </script> | below is how I am trying to call the functions, | <script language="javas cript" event="onclick( )" for="btn_user"> | openwin(); | </script> | <script language="javas cript" event="onclick( )" for="btn_clear" > | closewin(); | </script> | </form> | thanks, | -- | Paul G | Software engineer.
Afraid not, Paul. The problem isn't the name, it's what it points to, which
is gone after the PostBack. It's an actual in-memory handle to a browser
window. There is simply no way to persist it.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
"Paul" <Pa**@discussio ns.microsoft.co m> wrote in message
news:15******** *************** ***********@mic rosoft.com... Hi thanks for the response. Yes everything is new as you mentioned. I was able to get it working by using the <input statement for the button that opens the child window, does not cause a post back. I have another
window that has a column of buttons in a data grid and when these buttons are selected, it opens a child window. Guess in this case it is posting back
to the server so will have to some how save off the handle name and then retreive it and use it in the onunload event of the parent window in the
body tag, so when the parent window navigates away the child window if left
open will be closed.
"Kevin Spencer" wrote:
A PostBack is certainly going to lose the handle. You realize that each
Page instance is occurring in a vacuum, don't you? When the page reloads into
the browser, everything is new.
-- HTH, Kevin Spencer ..Net Developer Microsoft MVP Neither a follower nor a lender be.
"Paul" <Pa**@discussio ns.microsoft.co m> wrote in message news:21******** *************** ***********@mic rosoft.com... ok thanks for the information, could be that a postback is happening
so loosing the handle. Guess one could save the handle in a session variable,not quite sure how this would work.
"bruce barker" wrote:
> the code is ok, but if the open button click fires a postback, or a postback > is done before you call close it will not work, as you will have
lost the > window handle. > > -- bruce (sqlwork.com) > > "Paul" <Pa**@discussio ns.microsoft.co m> wrote in message > news:0A******** *************** ***********@mic rosoft.com... > | Hi I have 2 functions in java script, one opens a second
window-this > works, > | the other is supposed to close this second window, does not seem
to be > | working. Just wondering if anyone had any ideas. > | Here is the code, > | the functions are > | <script language="javas cript"> > | function openwin(){ > | win_usr=window. open ("control_numin fo.aspx") > | } > | function closewin(){ > | win_usr.close() ; > | } > | </script> > | below is how I am trying to call the functions, > | <script language="javas cript" event="onclick( )" for="btn_user"> > | openwin(); > | </script> > | <script language="javas cript" event="onclick( )" for="btn_clear" > > | closewin(); > | </script> > | </form> > | thanks, > | -- > | Paul G > | Software engineer. > > > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: J P Singh |
last post by:
Hi Guys
Wonder if someone can help me with this.
I have a form where a user clicks a button which gives them a pop up windows
to allow them to add the data. The user adds the data and click save. The
pop window closes and refreshs the parent window to allow the entered data
to be displayed.
It was all working okay until couple of days...
|
by: Christine |
last post by:
I have a small window open that should close after 60 secs...works
fine if the user is not playing with the window. The problem occurs
when the user is moving the window around when the 60 secs is up...I
just hear a 'beep' and the window does not close until the user moves
on to the next page of the tutorial/site. Any insight?
Thanks,...
|
by: Asit |
last post by:
<META HTTP-EQUIV="expires" content="0">
<META HTTP-EQUIV="pragma" content="no-cache">
<html>
<head>
<title>Fidelity NetBenefits</title>
</head>
<body BGCOLOR="#ffffff">
<script LANGUAGE="JavaScript">
|
by: marcelf3 |
last post by:
Hello..
This page opens a window with some information, but everytime the user
changes a field in the parent window, the child window needs to be
closed.
These 2 functions were supposed to do the work.
Nota() - opens new window.
fechaNota() - closes the window opened by Nota()
here is the code.
|
by: lindanr |
last post by:
In ASP.NET 2005 I have an onblur="window.close()" javascript event in the
<body> tag. When I click on the window's scrollbar, the window closes. The
same code works fine in ASP.NET 2003.
Any ideas?
| |
by: nebulus |
last post by:
I'm working on a web app that under normal circumstances will be happy with the Session_OnEnd event, but when a user leaves a page by closing the browser by either Alt+F4 or just hitting the "X", I'll need to kill the session.
Now, with the onbeforeunload event, I can handle this quite easily in IE, but in FireFox, it's another matter. For one...
|
by: bsm |
last post by:
Hi,
I have googled for my issue in this group. This question was asked
many times and many solution was given. But I want clear cut solution
for the issue.
The issue is:
I tried to capture the browse close event by using
Body onunload=fn1() statement and it is working fine.
|
by: BibhuAshish |
last post by:
Hello,
I have created a context menu in mozilla by using following code:
function nrc(e) {
var contextMenu;
document.oncontextmenu = function (evt) {
var srcElement;
if (evt && evt.target) {
srcElement = evt.target;
|
by: sumanta123 |
last post by:
Dear All,
How will we do in JSP page on closing the parent window the child windows should close automatically.
I will show my code
Please i will show you my code.
For HTML link
function closeWin()
{
|
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...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
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. ...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |