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,height=300,status=no,toolbar=no,menubar =no,scrollbars=no');
wind1.document.write("<script> function alert1(f){");
wind1.document.write("var frmdst=f.ta.value;");
wind1.document.write("window.opener.tmp=frmdst;");
wind1.document.write("window.opener.getValues();") ;
wind1.document.write("window.close();");
wind1.document.write("}<\/script>");
wind1.document.write("<html><body><form action='#' name='myform' method='post'><TEXTAREA rows='2' cols='20' name='ta'></TEXTAREA><br><INPUT type='button' value='save' onclick='javascript:alert1(this.form);'><INPUT type='button' value='cancel' onclick='javascript:window.close();'></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]
13 1988 gits 5,390
Expert Mod 4TB
just use a variable:
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
just use a variable:
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.
gits 5,390
Expert Mod 4TB
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
Try setting the value of run as 1 or 0 on click of the OK or Cancel (respectively) of the pop up window.
gits 5,390
Expert Mod 4TB
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
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.
gits 5,390
Expert Mod 4TB
in your popup use:
onclick of save and set it to 0 when cancel is clicked.
kind regards
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,height=300,status=no,toolbar=no,menubar =no,scrollbars=no');
wind1.document.write("<script> function alert1(f){");
wind1.document.write("window.opener.run = 1;");
wind1.document.write("var frmdst=f.ta.value;");
wind1.document.write("window.opener.tmp=frmdst;");
wind1.document.write("window.opener.getValues();") ;
wind1.document.write("window.close();");
wind1.document.write("}<\/script>");
wind1.document.write("<html><body><form action='#' name='myform' method='post'><TEXTAREA rows='2' cols='20' name='ta'></TEXTAREA><br><INPUT type='button' value='save' onclick='javascript:alert1(this.form);window.opene r.run = 0;'><INPUT type='button' value='cancel' onclick='javascript:window.close();window.opener.r un = 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]
Thanks alot...!
its working now.:)
gits 5,390
Expert Mod 4TB
hi ...
glad to hear that :) it seems that you had set the variable to 0 in both of the cases? ...
one note:
just use: - onclick='window.opener.run = 0;'
the javascript: is useless today ...
kind regards
the javascript: is useless today ...
.... unless you have to call a JavaScript function in an href attribute.
.... unless you have to call a JavaScript function in an href attribute.
...which you shouldn't need to do unless it's a bookmarklet.
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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?
...
|
by: raashid bhatt |
last post by:
What is #pragma once used for
and
what is #WIN#@_LEN_AND_MEAN
|
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...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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,...
| |