473,804 Members | 3,353 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

pop up once

8 New Member
Hi,

can any one help me to create the pop up only once. on clicking the text box

[HTML]<html>
<head>
<script type="text/javascript">
function abc()
{
var wind1=null;
var tmp=null;
wind1 = window.open('', 'displayWindow' , 'width=400,heig ht=300,status=n o,toolbar=no,me nubar =no,scrollbars= no');
wind1.document. write("<script> function alert1(f){");
wind1.document. write("var frmdst=f.ta.val ue;");
wind1.document. write("window.o pener.tmp=frmds t;");
wind1.document. write("window.o pener.getValues ();");
wind1.document. write("window.c lose();");
wind1.document. write("}<\/script>");
wind1.document. write("<html><b ody><form action='#' name='myform' method='post'>< TEXTAREA rows='2' cols='20' name='ta'></TEXTAREA><br><I NPUT type='button' value='save' onclick='javasc ript:alert1(thi s.form);'><INPU T type='button' value='cancel' onclick='javasc ript:window.clo se();'></form></body></html>");
}
function getValues()
{
document.forms["source"].elements["srctext"].value = tmp;
}
</script>
</head>
<body>
<form action="#" name="source" method="get">
<input type="text" onclick='abc(); ' name="srctext" value="" size="20" />
</form>
<body>
</html>[/HTML]
Feb 28 '08 #1
13 2022
gits
5,390 Recognized Expert Moderator Expert
just use a variable:

Expand|Select|Wrap|Line Numbers
  1. var run = 0;
  2.  
when you click open the popup and set run to 1 ... in the open-window code check for run == 0 otherwise simply return from the opening function ...

kind regards
Feb 28 '08 #2
destiny007
8 New Member
just use a variable:

Expand|Select|Wrap|Line Numbers
  1. var run = 0;
  2.  
when you click open the popup and set run to 1 ... in the open-window code check for run == 0 otherwise simply return from the opening function ...

kind regards
Thanks alot..I tried it but after I am clicking cancel i am unable to get the popup again.
Feb 29 '08 #3
gits
5,390 Recognized Expert Moderator Expert
since you didn't tell that that is a requirement this should be true :) ... just set the variable run in the opener back to 0 when you click cancel in your popup :)

kind regards
Feb 29 '08 #4
hsriat
1,654 Recognized Expert Top Contributor
Try setting the value of run as 1 or 0 on click of the OK or Cancel (respectively) of the pop up window.
Feb 29 '08 #5
gits
5,390 Recognized Expert Moderator Expert
Try setting the value of run as 1 or 0 on click of the OK or Cancel (respectively) of the pop up window.
yup that would be a more straight way for the entire handling :)

kind regards
Feb 29 '08 #6
destiny007
8 New Member
Thanks!

Can you please help me to write the code for resetting the value on Clicking "cancel" or "save".

I think its not working as its a global variable.


Regards.
Feb 29 '08 #7
gits
5,390 Recognized Expert Moderator Expert
in your popup use:

Expand|Select|Wrap|Line Numbers
  1. window.opener.run = 1;
  2.  
onclick of save and set it to 0 when cancel is clicked.

kind regards
Feb 29 '08 #8
destiny007
8 New Member
its still not working ...can you please rectify the errors.

here is the code

[HTML]<html>
<head>
<script type="text/javascript">
var run=0;
function abc()
{
if(run==0)
{
var wind1=null;
var tmp=null;
wind1 = window.open('', 'displayWindow' , 'width=400,heig ht=300,status=n o,toolbar=no,me nubar =no,scrollbars= no');
wind1.document. write("<script> function alert1(f){");
wind1.document. write("window.o pener.run = 1;");
wind1.document. write("var frmdst=f.ta.val ue;");
wind1.document. write("window.o pener.tmp=frmds t;");
wind1.document. write("window.o pener.getValues ();");
wind1.document. write("window.c lose();");
wind1.document. write("}<\/script>");
wind1.document. write("<html><b ody><form action='#' name='myform' method='post'>< TEXTAREA rows='2' cols='20' name='ta'></TEXTAREA><br><I NPUT type='button' value='save' onclick='javasc ript:alert1(thi s.form);window. opener.run = 0;'><INPUT type='button' value='cancel' onclick='javasc ript:window.clo se();window.ope ner.run = 0;'></form></body></html>");
}

}

function getValues()
{
document.forms["source"].elements["srctext"].value = tmp;
}

</script>
</head>
<body onload="">
<form action="#" name="source" method="get">
<input type="text" onclick='abc(); ' name="srctext" value="" size="20" />
</form>
<body>
</html>[/HTML]
Feb 29 '08 #9
destiny007
8 New Member
Thanks alot...!

its working now.:)
Feb 29 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2239
by: Stuart A Yeates | last post by:
I'm trying to write a template that matches "*" but which has an if clause which if only executed once per type of element seen (where all elements of a type have the same name and namespace). The test in the example below doesn't work, but it seems that there must be some relatively simple text i'm overlooking. <!-- - process an element --> <xsl:template match="*">
1
2144
by: Jacob Jensen | last post by:
Hi I have a problem creating C++ code that is multiplatform compilable. My problem is using the "#pragma once" directive which can be used by microsoft Visual Studio pre-compiler but which gives warnings when used by gcc for example. I would like to use it when compiling with Visual C++ compiler, but how can I create a smart macro or something, so that it is truly ignored when compiler with gcc. I have tried the following which actually...
2
2773
by: Just Me | last post by:
When a document is to be printed I call a method that contains an AddHandler statement. I just realized that if a second copy is to be printed the method is called and the AddHandler is executed again. Is doing AddHandler a second time wrong? I did check and even though I do AddHandler 3 times the handler is only called once.
5
2383
by: ShaunO | last post by:
BACKGROUND I have the following classes as part of a program that opens 3 Asynchronous Sockets. Each socket is in a separate instance of a wrapping class. 1x User Interface class 1x Client Manager class 3x Client class Instances The Client class raises events when the client connects. The User interface has registered with that event.
5
3126
by: =?Utf-8?B?UmljaA==?= | last post by:
Greetings, I have been using the Click Once deployment feature of VS2005 - very nice. I had IE6 at the time when I started using Click Once Deployment, and everything worked fine. But then my workstation got upgraded to IE7, and now whenever I deploy an application and IE7 comes up for the Install page - it just says "Connecting..." and just hangs, and then I have to manually end the program. I did not have this problem with IE6. Are...
10
1513
by: Lorenzo Di Gregorio | last post by:
Hello, I've been using Python for some DES simulations because we don't need full C speed and it's so much faster for writing models. During coding I find it handy to assign a variable *unless it has been already assigned*: I've found that this is often referred to as "once" assigment. The best I could come up with in Python is:
29
2239
by: Neil | last post by:
Running a SQL 7 system on a Windows 2000 server using Access 2000 on client machines as a front end. System administrator currently reboots the server once a month. Yesterday we had some weird thing with the database where users were getting ODBC errors when trying to access it. Rebooted the server, everything was fine. Suggested to the sa that he reboot the server once a week. He said he already does it once a month, and that's sufficient....
26
3832
by: Rick | last post by:
I'm told that "#pragma once" has made it into the ISO standard for either C or C++. I can't find any reference to that anywhere. If it's true, do any of you have a reference I can use? Thanks...
5
25227
by: raashid bhatt | last post by:
What is #pragma once used for and what is #WIN#@_LEN_AND_MEAN
4
6128
by: Yonih | last post by:
Hey Yall, I am trying to incorporate a Once Per session Cookie that will expire once the browser is closed so some one who comes to my website will see my popup the first time her visits the website but it wont keep showing as one navigates throughout the site however if he closes the browser and reopens out site it will show again. Here is the script that I was using that started out to work once per session but after publishing the...
0
9591
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,...
0
10594
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, 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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10331
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,...
0
10087
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 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...
0
9166
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, 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...
1
7631
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6861
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3001
bsmnconsultancy
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...

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.