a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Hosting from $3.99 per month!

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions. dd

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

Javascript - Close New Window HELP

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> General Web Development >> Javascript - Close New Window HELP
Page: [1]
 
peachgurl

 

Posts: 13
Joined: 2/6/2007
Status: offline

 
Javascript - Close New Window HELP - 4/1/2007 18:43:06   
I have a javascript that writes to a yahoo page to make a pool tournament. Right now when u click "create" a new window pops up and the tournament is made. I would like a way for this new window to close itself after like 10 seconds. I need help with a script and how to put it into my script. Here's my page:

<HEAD>


<SCRIPT language=JavaScript>
var temp = "";
function plus15() {
if (document.createform.tourney_start_minute.selectedIndex == 2 && document.createform.tourney_start_hour.selectedIndex == 0) {
document.createform.tourney_start_minute.selectedIndex = 2;
document.createform.signup_end_minute.selectedIndex = 2;
}


if (document.createform.tourney_start_minute.selectedIndex == 10 && document.createform.tourney_start_hour.selectedIndex == 23) {
document.createform.tourney_start_minute.selectedIndex = 2;
document.createform.tourney_start_hour.selectedIndex = 2;
document.createform.tourney_start_day.selectedIndex = document.createform.tourney_start_day.selectedIndex + 2;
document.createform.signup_end_minute.selectedIndex = 2;
document.createform.signup_end_hour.selectedIndex = 2;
document.createform.signup_end_day.selectedIndex = document.createform.signup_end_day.selectedIndex + 1;
}
else {
if (document.createform.tourney_start_minute.selectedIndex == 10) {
document.createform.tourney_start_hour.selectedIndex=document.createform.tourney_start_hour.selectedIndex + 1;
document.createform.signup_end_hour.selectedIndex=document.createform.signup_end_hour.selectedIndex + 1;
document.createform.tourney_start_minute.selectedIndex= 2;
document.createform.signup_end_minute.selectedIndex= 2;
}
else {
document.createform.tourney_start_minute.selectedIndex=document.createform.tourney_start_minute.selectedIndex + 2;
document.createform.signup_end_minute.selectedIndex=document.createform.signup_end_minute.selectedIndex + 2;
}
}

if (document.createform.alternate9.checked == true) {
if (document.createform.opt_nineBallGame.checked == false)
document.createform.opt_nineBallGame.checked = true;
else
document.createform.opt_nineBallGame.checked = false;
}
if (document.createform.rememtext.checked == true) {
document.createform.title.value=document.createform.title.value;
}
else {
document.createform.title.value="";
}
random_timer();
document.createform.title.focus();
}
function random_timer() {
ran_time = Math.round(Math.random()*30);
beg = document.createform.ranbeg.value;
end = document.createform.ranend.value;
if (document.createform.random_timercheck.checked == true) {
if (ran_time < beg) {
random_timer(beg, end);
}
if (ran_time > end) {
random_timer(beg, end);
}
else {
document.createform.opt_timer.value = ran_time;
}
}
}
function changesignupendhour(name){
document.createform.tourney_start_hour.selectedIndex=name;
}
function changesignupendminute(name){
document.createform.tourney_start_minute.selectedIndex=name;
}
function changesignupendmonth(name){
document.createform.tourney_start_month.selectedIndex=name;
}
function changesignupendday(name){
document.createform.tourney_start_day.selectedIndex=name;
}
function changesignupendyear(name){
document.createform.tourney_start_year.selectedIndex=name;
}
function changetourneystarthour(name){
document.createform.signup_end_hour.selectedIndex=name;
}
function changetourneystartminute(name){
document.createform.signup_end_minute.selectedIndex=name;
}
function changetourneystartmonth(name){
document.createform.signup_end_month.selectedIndex=name;
}
function changetourneystartday(name){
document.createform.signup_end_day.selectedIndex=name;
}
function changetourneystartyear(name){
document.createform.signup_end_year.selectedIndex=name;
}
</SCRIPT>

<META http-equiv=Pragma content=no-cache>
<META content=recreation name=keywords>
<META content=recreation name=description>
<META content="Microsoft FrontPage 5.0" name=GENERATOR>


</HEAD>
<BODY text=#000000 bgColor=#2A1260>
<DIV style="Z-INDEX: 1000; POSITION: relative" align=center>


<SCRIPT language=JavaScript src="">
</SCRIPT>

<SCRIPT language=JavaScript src=""
type=text/javascript></SCRIPT>
<font face="Arial" style="font-size: 9pt"> </NOSCRIPT></font></DIV>
<FORM name=createform onsubmit="setTimeout('plus15()', 2000)"
action=http://leagues.games.yahoo.com/tourney/docreate method=get target=_blank>
<div align="center">
<center>
<TABLE width="60%" border=1 style="border-collapse: collapse" bordercolor="#E2E2E2" cellpadding="3" cellspacing="0" bgcolor="#3C2082">
<TBODY>
<TR>
<TD height=27 width="30%" align="right">
<font face="Arial" style="font-size: 9pt" color="#E2E2E2">Name of Tourney:</font></TD>
<TD width="71%"><font face="Arial"><span style="font-size: 9pt">
<font color="#E2E2E2">
<INPUT maxLength=50 size=43 name=title> </font> </span></font> </TD></TR>
<TR>
<TD width="30%" align="right">
<font face="Arial" style="font-size: 9pt" color="#E2E2E2">9 Ball</font></TD>
<TD width="71%"><font face="Arial" color="#E2E2E2"><span style="font-size: 9pt"><INPUT type=checkbox value=y name=opt_nineBallGame></span></font></TD></TR>
<TR>
<TD width="30%" align="right">
<font face="Arial" style="font-size: 9pt" color="#E2E2E2">Timer</font></TD>
<TD width="71%"><font face="Arial"><span style="font-size: 9pt">
<font color="#E2E2E2"> <INPUT maxLength=2 size=2 name=opt_timer>
</font> </span></font></TD></TR>
<TR>
<TD width="30%" align="right">
<font face="Arial" style="font-size: 9pt" color="#E2E2E2">Signup End:</font></TD>
<TD width="71%"><font face="Arial"><span style="font-size: 9pt">
<font color="#E2E2E2"><SELECT onchange=changesignupendhour(signup_end_hour.selectedIndex)
name=signup_end_hour> <OPTION value=0 selected>0:00</OPTION> <OPTION
value=1>1:00</OPTION> <OPTION value=2>2:00</OPTION> <OPTION
value=3>3:00</OPTION> <OPTION value=4>4:00</OPTION> <OPTION
value=5>5:00</OPTION> <OPTION value=6>6:00</OPTION> <OPTION
value=7>7:00</OPTION> <OPTION value=8>8:00</OPTION> <OPTION
value=9>9:00</OPTION> <OPTION value=10>10:00</OPTION> <OPTION
value=11>11:00</OPTION> <OPTION value=12>12:00</OPTION> <OPTION
value=13>13:00</OPTION> <OPTION value=14>14:00</OPTION> <OPTION
value=15>15:00</OPTION> <OPTION value=16>16:00</OPTION> <OPTION
value=17>17:00</OPTION> <OPTION value=18>18:00</OPTION> <OPTION
value=19>19:00</OPTION> <OPTION value=20>20:00</OPTION> <OPTION
value=21>21:00</OPTION> <OPTION value=22>22:00</OPTION> <OPTION
value=23>23:00</OPTION></SELECT> <SELECT
onchange=changesignupendminute(signup_end_minute.selectedIndex)
name=signup_end_minute> <OPTION value=0 selected>0</OPTION> <OPTION
value=5>5</OPTION> <OPTION value=10>10</OPTION> <OPTION
value=15>15</OPTION> <OPTION value=20>20</OPTION> <OPTION
value=25>25</OPTION> <OPTION value=30>30</OPTION> <OPTION
value=35>35</OPTION> <OPTION value=40>40</OPTION> <OPTION
value=45>45</OPTION> <OPTION value=50>50</OPTION> <OPTION
value=55>55</OPTION></SELECT> <SELECT
onchange=changesignupendmonth(signup_end_month.selectedIndex)
name=signup_end_month> <OPTION value=0 selected>January</OPTION> <OPTION
value=1>February</OPTION> <OPTION value=2>March</OPTION> <OPTION
value=3>April</OPTION> <OPTION value=4>May</OPTION> <OPTION
value=5>June</OPTION> <OPTION value=6>July</OPTION> <OPTION
value=7>August</OPTION> <OPTION value=8>September</OPTION> <OPTION
value=9>October</OPTION> <OPTION value=10>November</OPTION> <OPTION
value=11>December</OPTION></SELECT> <SELECT
onchange=changesignupendday(signup_end_day.selectedIndex)
name=signup_end_day> <OPTION value=1 selected>1</OPTION> <OPTION
value=2>2</OPTION> <OPTION value=3>3</OPTION> <OPTION value=4>4</OPTION>
<OPTION value=5>5</OPTION> <OPTION value=6>6</OPTION> <OPTION
value=7>7</OPTION> <OPTION value=8>8</OPTION> <OPTION value=9>9</OPTION>
<OPTION value=10>10</OPTION> <OPTION value=11>11</OPTION> <OPTION
value=12>12</OPTION> <OPTION value=13>13</OPTION> <OPTION
value=14>14</OPTION> <OPTION value=15>15</OPTION> <OPTION
value=16>16</OPTION> <OPTION value=17>17</OPTION> <OPTION
value=18>18</OPTION> <OPTION value=19>19</OPTION> <OPTION
value=20>20</OPTION> <OPTION value=21>21</OPTION> <OPTION
value=22>22</OPTION> <OPTION value=23>23</OPTION> <OPTION
value=24>24</OPTION> <OPTION value=25>25</OPTION> <OPTION
value=26>26</OPTION> <OPTION value=27>27</OPTION> <OPTION
value=28>28</OPTION> <OPTION value=29>29</OPTION> <OPTION
value=30>30</OPTION> <OPTION value=31>31</OPTION></SELECT> <SELECT
onchange=changesignupendyear(signup_end_year.selectedIndex) size=1
name=signup_end_year> <OPTION value=2007 selected>2007</OPTION> <OPTION
value=2008>2008</OPTION></SELECT></font></span></font></TD></TR>
<TR>
<TD width="30%" align="right">
<font face="Arial" style="font-size: 9pt" color="#E2E2E2">Tourney Start:</font></TD>
<TD width="71%"><font face="Arial"><span style="font-size: 9pt">
<font color="#E2E2E2"><SELECT
onchange=changetourneystarthour(tourney_start_hour.selectedIndex)
name=tourney_start_hour> <OPTION value=0 selected>0:00</OPTION> <OPTION
value=1>1:00</OPTION> <OPTION value=2>2:00</OPTION> <OPTION
value=3>3:00</OPTION> <OPTION value=4>4:00</OPTION> <OPTION
value=5>5:00</OPTION> <OPTION value=6>6:00</OPTION> <OPTION
value=7>7:00</OPTION> <OPTION value=8>8:00</OPTION> <OPTION
value=9>9:00</OPTION> <OPTION value=10>10:00</OPTION> <OPTION
value=11>11:00</OPTION> <OPTION value=12>12:00</OPTION> <OPTION
value=13>13:00</OPTION> <OPTION value=14>14:00</OPTION> <OPTION
value=15>15:00</OPTION> <OPTION value=16>16:00</OPTION> <OPTION
value=17>17:00</OPTION> <OPTION value=18>18:00</OPTION> <OPTION
value=19>19:00</OPTION> <OPTION value=20>20:00</OPTION> <OPTION
value=21>21:00</OPTION> <OPTION value=22>22:00</OPTION> <OPTION
value=23>23:00</OPTION></SELECT> <SELECT
onchange=changetourneystartminute(tourney_start_minute.selectedIndex)
name=tourney_start_minute> <OPTION value=0 selected>0</OPTION> <OPTION
value=5>5</OPTION> <OPTION value=10>10</OPTION> <OPTION
value=15>15</OPTION> <OPTION value=20>20</OPTION> <OPTION
value=25>25</OPTION> <OPTION value=30>30</OPTION> <OPTION
value=35>35</OPTION> <OPTION value=40>40</OPTION> <OPTION
value=45>45</OPTION> <OPTION value=50>50</OPTION> <OPTION
value=55>55</OPTION></SELECT> <SELECT
onchange=changetourneystartmonth(tourney_start_month.selectedIndex)
name=tourney_start_month> <OPTION value=0 selected>January</OPTION>
<OPTION value=1>February</OPTION> <OPTION value=2>March</OPTION> <OPTION
value=3>April</OPTION> <OPTION value=4>May</OPTION> <OPTION
value=5>June</OPTION> <OPTION value=6>July</OPTION> <OPTION
value=7>August</OPTION> <OPTION value=8>September</OPTION> <OPTION
value=9>October</OPTION> <OPTION value=10>November</OPTION> <OPTION
value=11>December</OPTION></SELECT> <SELECT
onchange=changetourneystartday(tourney_start_day.selectedIndex)
name=tourney_start_day> <OPTION value=1 selected>1</OPTION> <OPTION
value=2>2</OPTION> <OPTION value=3>3</OPTION> <OPTION value=4>4</OPTION>
<OPTION value=5>5</OPTION> <OPTION value=6>6</OPTION> <OPTION
value=7>7</OPTION> <OPTION value=8>8</OPTION> <OPTION value=9>9</OPTION>
<OPTION value=10>10</OPTION> <OPTION value=11>11</OPTION> <OPTION
value=12>12</OPTION> <OPTION value=13>13</OPTION> <OPTION
value=14>14</OPTION> <OPTION value=15>15</OPTION> <OPTION
value=16>16</OPTION> <OPTION value=17>17</OPTION> <OPTION
value=18>18</OPTION> <OPTION value=19>19</OPTION> <OPTION
value=20>20</OPTION> <OPTION value=21>21</OPTION> <OPTION
value=22>22</OPTION> <OPTION value=23>23</OPTION> <OPTION
value=24>24</OPTION> <OPTION value=25>25</OPTION> <OPTION
value=26>26</OPTION> <OPTION value=27>27</OPTION> <OPTION
value=28>28</OPTION> <OPTION value=29>29</OPTION> <OPTION
value=30>30</OPTION> <OPTION value=31>31</OPTION></SELECT> <SELECT
onchange=changetourneystartyear(tourney_start_year.selectedIndex) size=1
name=tourney_start_year> <OPTION value=2007 selected>2007</OPTION>
<OPTION value=2008>2008</OPTION></SELECT></font></span></font></TD></TR>
<TR>
<TD width="30%" align="right"> </TD>
<TD width="71%"><font face="Arial" style="font-size: 9pt" color="#E2E2E2">
<INPUT id=create style="WIDTH: 125; height:28; font-weight:bold" type=submit value=Create name=create></font></TD></TR>
<DIV></DIV></TBODY></TABLE>
</center>
</div>
<P><font face="Arial"><span style="font-size: 9pt"><!-- start hidden values//--><BR>
<INPUT type=hidden
value=kingandqueens_2174083608_6 name=room>
<INPUT type=hidden
name=signup_start_hour value> <INPUT type=hidden name=signup_start_minute value>
<INPUT
type=hidden name=signup_start_month value>
<INPUT type=hidden name=signup_start_day value>
<INPUT type=hidden name=signup_start_year value> <BR><INPUT type=hidden value=2
name=min_users> <INPUT type=hidden value=128 name=max_users> <INPUT type=hidden
value=600 name=time_per_round> <BR><!--option count DO NOT EDIT //--><INPUT
type=hidden value=3 name=option_count> <INPUT type=hidden value=timer
name=option_0> <INPUT type=hidden value=nineBallGame name=option_1> <INPUT
type=hidden value=rd name=option_2> <BR><!--Rated//--><INPUT type=hidden value=y
name=opt_rd> <BR><!--Pairing//--><INPUT type=hidden value=1 name=pairing> <BR><!--End Hidden values//-->
</span></font></P><input type="hidden" name="rememtext" value="y">
<input type="hidden" name="private" value="y"></FORM>
<SCRIPT>

var time=new Date();
var month=time.getMonth();
var date=time.getDate();
var hour = time.getHours();

document.createform.signup_start_month.value = month;
document.createform.signup_start_day.value = date;
document.createform.signup_start_hour.value = hour;
document.createform.signup_start_minute.value = 2;
document.createform.signup_start_year.value = 2007;

document.createform.signup_end_month.selectedIndex = month;
document.createform.signup_end_day.selectedIndex = date;
if (hour == 23)
document.createform.signup_end_hour.selectedIndex = 0;
else
document.createform.signup_end_hour.selectedIndex = hour +1;
document.createform.signup_end_minute.selectedIndex = 2;

document.createform.tourney_start_month.selectedIndex = month;
document.createform.tourney_start_day.selectedIndex = date;
if (hour == 23)
document.createform.tourney_start_hour.selectedIndex = 0;
else
document.createform.tourney_start_hour.selectedIndex = hour +1;
document.createform.tourney_start_minute.selectedIndex = 2;
</SCRIPT>
<p> </p>
</BODY></HTML>
markhawker

 

Posts: 511
Joined: 5/31/2004
From: UK
Status: offline

 
RE: Javascript - Close New Window HELP - 4/2/2007 10:21:01   
Hey, I'm actually not sure if that is possible since the form action opens a new window due to the target="_blank" in the form tag.

As the new window points to the page http://leagues.games.yahoo.com/tourney/docreate you have no control of closing that window. You can close the window with the form in by adding this.close() inside the plus15() method which will close it after 2 seconds.

What you could do is add the following to the plus15() method and give it a try:

newWindow = window.open('http://leagues.games.yahoo.com/tourney/docreate','newWin','width=300,height
=100');
setTimeout(newWindow.close(), 10000);

And set action="" and remove the target property.

Not sure if this'll work though so keep a backup!

Mark

_____________________________

Mark Hawker
personal - http://www.meeid.com/markhawker

(in reply to peachgurl)
Page:   [1]
OutFront Discoveries

All Forums >> Web Development >> General Web Development >> Javascript - Close New Window HELP
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts