Hello all,
Help me!
--------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<script language="JavaS cript">
<!--
function popMe() {
openMe = window.open('ht tp://www.google.com/','google','loc ation=no,
status=no, width=640, height=480, left=100, top=100');
openMe.focus();
}
function closeOpened() {
closeIt = window.close('g oogle'); // I need help on this line.
}
//-->
</script>
</head>
<body>
<input type="button" value="Click me!" onclick="popMe( );" /> <input
type="button" value="Close opened" onclick="closeO pened();" />
</body>
</html>
--------------------
I have one button says "Click me!" when I click on that button its
calls a function "popMe()" and opens a popup window. And also I have
another button which says "Close Opened" and when I click on it, it
doesn't close the opened window.
Is my script is wrong? Help me on the function "closeOpened()" .
Thank you in adv.
-----
Sujan 6 12819
Sujan wrote: function popMe() { openMe = window.open('ht tp://www.google.com/','google','loc ation=no, status=no, width=640, height=480, left=100, top=100'); openMe.focus(); }
function closeOpened() { closeIt = window.close('g oogle'); // I need help on this line. }
You must call the close method of your opened window, not from your
current one:
if (openMe && openMe.close && !openMe.closed)
openMe.close();
Daniel
Thanks.
It worked, but there's a problem. When i click on "Close Opened"
without opening a popup, it says error on page 'openMe' is undefined.
Can I alert the user when they click first "Close Opened" button
without opening popup.
I'll be Thankful.
-----
Sujan
"Sujan" <su*****@gmail. com> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. . Hello all,
Help me!
-------------------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <script language="JavaS cript"> <!-- function popMe() { openMe = window.open('ht tp://www.google.com/','google','loc ation=no, status=no, width=640, height=480, left=100, top=100'); openMe.focus(); }
function closeOpened() { closeIt = window.close('g oogle'); // I need help on this line. } //--> </script>
</head>
<body>
<input type="button" value="Click me!" onclick="popMe( );" /> <input type="button" value="Close opened" onclick="closeO pened();" />
</body> </html> --------------------
I have one button says "Click me!" when I click on that button its calls a function "popMe()" and opens a popup window. And also I have another button which says "Close Opened" and when I click on it, it doesn't close the opened window.
Is my script is wrong? Help me on the function "closeOpened()" .
Thank you in adv.
----- Sujan
Will this help? Watch for word-wrap.
<html>
<head>
<title>closer.h tml</title>
<script type="text/javascript">
var pop;
function popOpen() {
pop = window.open('ht tp://www.google.com/','google','sta tus=no,width=64 0,
height=480,left =100,top=100');
}
</script>
</head>
<body>
<form>
<input type="button" value="Click me!" onclick="popOpe n();" />
<input type="button" value="Close it!" onclick="pop.cl ose()" />
</form>
</body>
</html>
Of course, you can still have:
function popClose() {
pop.close();
}
<input type="button" value="Close it!" onclick="popClo se()" />
Sujan wrote: It worked, but there's a problem. When i click on "Close Opened" without opening a popup, it says error on page 'openMe' is undefined.
You need to either check the existence of your global variable first or
define one before.
Can I alert the user when they click first "Close Opened" button without opening popup.
if (typeof openMe == "object" && openMe.close && !openMe.closed)
openMe.close();
else
alert("No window open");
Daniel
Thank you ppls, now it works better.
-----
Sujan
Thank you ppls, now it works better.
-----
Sujan This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: dibyendu_k |
last post by:
Hi,
There is a problem i cant solve regarding Internet Explorer 5.5. It is regarding the Print Dialog Box.
From a webpage if I open a popup window (window.open()) containing buttons Print and Close.
The functionality is that when i press the "print" button the Print dialog box is opened (window.print();)
and when I click on the close button the popup window is closed (window.close();)
But the problem occurs when
1. The Print button is...
|
by: GrantS |
last post by:
I am having a problem closing a popup window opened modally. When I
try to close the window (when the user hits save button and the data
has been processed), the Popup window opens as a full screen as a new
window. The original window plus the Modally opened Pop remain in a
separate window.
What I want to do is close the popup and return to the original window
with its view state maintained.
The control use to fire the popup window...
|
by: Temp |
last post by:
Can anyone tell me how I can open a new browser window when a button is
pressed?
I tried adding an <a href=...> encapsulating the button, but it didnt work.
Any suggestions?
--
_____________________________
Ron Rodenberg
|
by: David W. Simmonds |
last post by:
I have a popup window appear when a user clicks on a hyperlink in a
datalist. I do it like this:
dr = "javascript:mywindow=window.open(" +
"\"GameStats.aspx?Date="+dr + "&Away="+dr + "&Home="+dr + "\"" +
",\"GamesStats\",\"toolbar=no,location=no,directories=no,menubar=no,resizabl
e=yes,scrollbars=yes,width=640,height=300\");mywindow.focus();";
dr is a DataRow item that is added to a DataTable that becomes the
DataSource of the...
|
by: Chrysan |
last post by:
I have a popup window, which consist of a asp:textbox and a asp:button. And,
I would like to pass the textbox.text to the javascript function when I click
the button. Besides, by clicking the button, also close the popup window. The
problem is, when I click the button, the textbox.text is successfully pass to
the javascript function and the popup window will be closed, but the popup
window will be opened again in maximize mode. I notice...
| |
by: coimbatoresivakumar |
last post by:
hi friends
i'm using dotnet2003 c#
i want popup window.
calling popup window from parent window is no problem...
but i want return value from popup.
i have one textbox and one link button in parent window.
|
by: dittu |
last post by:
How to close the popup window when submitting the form?
I have a sample.jsp. In that page one button is there.
when button pressed, open popup window contains one "text box" and one " submit button". when "submit" button pressed, call the "servlet" in this popup window and then close the "popup" window.
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var X = 200; // change the # at the left for a fixed X co-ordinate to accommodate...
|
by: ismailc |
last post by:
Good day, I need help.
I have an html button that calls & open another browser window on the onMouseUp event, but once I close the popup new browser window my button has focus & is like selected.
I want it not to be selected or clicked or has focus, how do i loose the focus after close of popup window?
onMouseUp="window.open("
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |