473,770 Members | 4,553 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JS opening two windows instead of one

When this form's being submitted, two windows are opening instead of only
one
here is the function I'm using:

function subForm(){
//insert form validation here
//if form is valid, open a pop-window & submit
subWin =
window.open("ht tp://www.smoochya.co m/books.html","su bWin","width=55 0,height=
350,address=no" )
document.SendSc ore.action = "tellafriend_qu iz1.php"
document.SendSc ore.method = "post"
document.SendSc ore.target = subWin
document.SendSc ore.submit()
}

here is the form in the HTML body:
<FORM NAME="SendScore " >
<INPUT TYPE="hidden" name="numbercor rect" value="">
<INPUT TYPE="IMAGE" onClick="subFor m()" SRC="/images/passitalong_qui z.jpg"

</FORM>

the only other thing going on which probably is not interfering is the fact
that I'm making that "hidden" variable switch to a javascript variable from
being submitted by another form page that comes before this one.
I'm calling it in the BODY tag using onLoad="Javascr ipt:
SwitchNumberRig ht();" which calls this function:

function SwitchNumberRig ht(){
document.SendSc ore.numbercorre ct.value = numberright;
}

anyway the code can be viewed by going to http://www.smoochya.com/quiz1.html
and picking some answers (or not picking any) on the quiz. You'll notice
that one of the windows gives you your score while the other one (without
any toolbars) doesn't. Can't seem to get it to open only one window with the
score included.

Any help greatly appreciated..
Thanks,
M
Jul 20 '05 #1
3 1714
Lee
Display Name said:

When this form's being submitted, two windows are opening instead of only
one
here is the function I'm using:

function subForm(){
//insert form validation here
//if form is valid, open a pop-window & submit
subWin =
window.open("h ttp://www.smoochya.co m/books.html","su bWin","width=55 0,height=
350,address=no ")
document.SendSc ore.action = "tellafriend_qu iz1.php"
document.SendSc ore.method = "post"
document.SendSc ore.target = subWin
document.SendSc ore.submit()
}


You're getting a second window because the window you open()
is not being set as the target of the form.

document.SendSc ore.target = "subWin"

The value of the target attribute is the name of the window, not
a reference to the window.

Jul 20 '05 #2
@SM


Lee a *crit :
Display Name said:

When this form's being submitted, two windows are opening instead of only
one
here is the function I'm using:

function subForm(){
//insert form validation here
//if form is valid, open a pop-window & submit
change the name of your popup
subWin =

popWin=
window.open("h ttp://www.smoochya.co m/books.html","su bWin","width=55 0,height=
350,address=no ")
document.SendSc ore.action = "tellafriend_qu iz1.php"
document.SendSc ore.method = "post"
document.SendSc ore.method = "get"
document.SendSc ore.target = subWin
document.SendSc ore.target = "subWin"
document.SendSc ore.submit()
}


You're getting a second window because the window you open()
is not being set as the target of the form.


and this window has same name as target ...
document.SendSc ore.target = "subWin"

The value of the target attribute is the name of the window, not
a reference to the window.


I think (but I could bad understand you) that the 'target'
is the target included in the window
truc = window.open('ur l','target','at tributes');
or with :
truc=window.ope n('page.htm','c hose','width=30 0,height=300,re sizable=0');

onclick="truc.l ocation = 'page_2.htm';"
would work as
<a href="page_2.ht m" target="chose"> page 2</a>
--
*************** *************** *************** *************** **
Stéphane MORIAUX : mailto:st****** *************** @wanadoo.fr
Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)
http://perso.wanadoo.fr/stephanemoriaux/internet/
*************** *************** *************** *************** **
Jul 20 '05 #3
Stephane...
you're the man. your edits worked even w/o having to adjust the target
parameters. thanks a lot!
M

"@SM" <st************ **@wanadoo.fr> wrote in message
news:3F******** *******@wanadoo .fr...


Lee a *crit :
Display Name said:

When this form's being submitted, two windows are opening instead of onlyone
here is the function I'm using:

function subForm(){
//insert form validation here
//if form is valid, open a pop-window & submit
change the name of your popup
subWin =


popWin=

window.open("h ttp://www.smoochya.co m/books.html","su bWin","width=55 0,height

=
350,address=no ")
document.SendSc ore.action = "tellafriend_qu iz1.php"
document.SendSc ore.method = "post"
document.SendSc ore.method = "get"
document.SendSc ore.target = subWin
document.SendSc ore.target = "subWin"
document.SendSc ore.submit()
}


You're getting a second window because the window you open()
is not being set as the target of the form.


and this window has same name as target ...
document.SendSc ore.target = "subWin"

The value of the target attribute is the name of the window, not
a reference to the window.


I think (but I could bad understand you) that the 'target'
is the target included in the window
truc = window.open('ur l','target','at tributes');
or with :
truc=window.ope n('page.htm','c hose','width=30 0,height=300,re sizable=0');

onclick="truc.l ocation = 'page_2.htm';"
would work as
<a href="page_2.ht m" target="chose"> page 2</a>
--
*************** *************** *************** *************** **
Stéphane MORIAUX : mailto:st****** *************** @wanadoo.fr
Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)
http://perso.wanadoo.fr/stephanemoriaux/internet/
*************** *************** *************** *************** **

Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
11096
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a window.open function? I would prefer not to create a separate HTML page. So far all I have is the basic var cwin = window.open('images/KJV-THANKS.gif', 'Thanks', 'width=243,height=420,'); cwin.focus();
2
2100
by: Matt Hamilton | last post by:
I have an application page with a datagrid with a checkbox on each row. The user should check the rows they want to modify and then click a button. When the button is clicked, I have a Click handler that builds a url and then registers a startup script to open a modal dialog window. With XP SP2 installed the pop-up blocker stops the windows from displaying. Is there any way around this? My users are too stupid to turn off the popup blocker...
4
26818
by: CliffKing | last post by:
I am trying to use Windows Task Scheduler to run a batch file for an already open MS Access database. Below is the syntax to the batch file: Batch file: DailySalesExport.bat REM This runs the macro that exports the reports to the J drive PATH = "C:\Program Files\Microsoft Office\Office\;C:\Windows\Command" START /WAIT Msaccess.exe "D:\acesdata\SALES\Daily2005.mdb" /x "SnapShotExportDailySales" EXIT
8
2131
by: Claudio Grondi | last post by:
Here an example of what I mean (Python 2.4.2, IDLE 1.1.2, Windows XP SP2, NTFS file system, 80 GByte large file): Traceback (most recent call last): File "<pyshell#1>", line 1, in -toplevel- f = file('veryBigFile.dat','r+') IOError: No such file or directory: 'veryBigFile.dat'
11
3526
by: emailus | last post by:
I am webmaster for the domain <www.alpha1.org.au>. Not being an expert in html, I take advantage of my domain Registrant's web building tool, 'Instant Website'. This tool is provided as part of the fee I pay for web hosting. 'Instant Website' provides the option of having your opening page as a Flash Page, which you'll see if you visit <www.alpha1.org.au>. Well, you'll see it if you visit from a Windows machine. For some reason, when...
1
1792
by: T | last post by:
Currently there is an excel shortcut available on the network with links to 30 or so access db (97 & 2003), since the users are complaining about all the messages from excel (already open, do you want to save etc), I thought about creating a html file that would accomplish the same thing, exept now I get the message do you want to save the file, and of course I don't. What is the quickest / easist way to create an interface on the...
34
5368
by: Alexnb | last post by:
Gerhard Häring wrote: No, it didn't work, but it gave me some interesting feedback when I ran it in the shell. Heres what it told me: Traceback (most recent call last): File "<pyshell#10>", line 1, in <module> os.startfile("C:\Documents and Settings\Alex\My Documents\My
3
1609
by: =?Utf-8?B?TGllbGE=?= | last post by:
I have a user who stores her documents on a different drive and when she attempts to open documents it auto defaults to My Documents instead of her other drive. Is there a way to change the default for her?
1
9396
by: santoshmaya | last post by:
When opening a PDF over SSL running on IIS 5.1 (Windows XP Professional, W2K Windows 2000, or Windows Server 2003), you may receive the following problem with Internet Explorer. First, instead of opening the PDF in Acrobat Reader, IE asks you, "Do you want to open or save this file?". If you click "Open", then you receive the error, "Internet Explorer cannot download file.pdf from servername. Internet Explorer was not able to open this...
0
9439
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
10237
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...
0
8905
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
7431
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
6690
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
5467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3987
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
2
3589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2832
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.