473,883 Members | 2,268 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 2027
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
2243
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
2778
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
2387
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
3131
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
1519
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
2241
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
3839
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
25243
by: raashid bhatt | last post by:
What is #pragma once used for and what is #WIN#@_LEN_AND_MEAN
4
6135
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
9799
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
10768
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 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...
1
10868
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,...
1
7980
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
7137
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
5808
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6009
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4231
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3242
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.