Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dialog Window Assist

Status
Not open for further replies.

idaryl

Technical User
Nov 10, 2001
156
US
Hello all,
I have this function below to generate a dialog when the user wants to "logout", however, it only shows one window if the user clicks OK - the client wants it to say Welcome Back if they click on the cancel button and another confirm asking Are you sure? if they click on the OK.

That way the user gets to change their mind before they are redirected to the main exit page.

Does someone know how to add this function the function I have already?

Code:
function conFirm() {
if (confirm("Are you sure you want\nto logout of our site?\n\nWe're really sorry to\nhave you leave us.   (VWI Staff)") ) 
{
parent.location='../index.html';
alert("GoodBye for now");
}
}

idaryl
idface.gif
 
You can use an ELSE clause on the IF and an ALERT to give you what you need.
 
function conFirm() {
if (confirm("Are you sure you want\nto logout of our site?\n\nWe're really sorry to\nhave you leave us. (VWI Staff)") )
{
parent.location='../index.html';
alert("GoodBye for now");
}
else
{
alert("Welcome Back.");
document.location.reload();
}
}


It's always in the details.
 
how about
Code:
function conFirm() {
	var bLeave = false;
	
	if (confirm("Are you sure you want\nto logout of our site?\n\nWe're really sorry to\nhave you leave us.   (VWI Staff)") ) {
		if (confirm("Really sure?")) {
			bLeave = true;
		}
	}
	
	if (bLeave) {
		parent.location='../index.html';
		alert("GoodBye for now");
	}
	else {
		alert("Welcome Back.");
		document.location.reload();
	}
}

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Hiya Jeff,

how are you - been a long time between notes

tried it but it didnt work on my Mac here

copied it direct into the logout.js file

idaryl
idface.gif
 
what part isn't working? works fine for me in IE and firefox on winxp

you might want to change this:
if (bLeave) {
parent.location='../index.html';
alert("GoodBye for now");
}

to this:
if (bLeave) {
alert("GoodBye for now");
parent.location='../index.html';
}

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
OK

I get an error message pertaining to line 3 character 1 on my PC..

and I'm also on IE5 on the Mac (but I dont think this matters - maybe!? - still I get the error on my Win 2000)

strange :-(



idaryl
idface.gif
 
you've probably got an error somewhere else then. let's see the whole page source

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
OK no probleme - here is the file

Code:
<HTML>
<HEAD>
<TITLE>Vision West - VWI</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<link href="vw_js_css/IncludeStyleSheet.css" id=skin rel=stylesheet type=text/css>
<script	src="vw_js_css/logout.js"	type="text/javascript"	language="Javascript"></script>
<link rel=stylesheet href="vw_js_css/left.css" type="text/css">
<script language="JavaScript">
<!--
function MM_reloadPage(init) {  //Updated by PVII. Reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>

</HEAD>
<BODY BGCOLOR=#FFFFFF background="vw_imgs/interface/background.gif" marginwidth="0" marginheight="0" topmargin="10" leftmargin="0" onLoad="MM_preloadImages('vw_imgs/tops/top.jpg','vw_imgs/mem_nav/member_navhi_01.jpg','vw_imgs/mem_nav/member_navhi_02.jpg','vw_imgs/mem_nav/member_navhi_03.jpg','vw_imgs/mem_nav/member_navhi_04.jpg','vw_imgs/mem_nav/member_navhi_05.jpg','vw_imgs/mem_nav/member_navhi_06.jpg','vw_imgs/mem_nav/member_navhi_07.jpg','vw_imgs/mem_nav/member_navhi_08.jpg')">
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 align="center" width="473" height="8">
  <TR> 
    <TD width="3"> <IMG SRC="vw_imgs/interface/spacer.gif" WIDTH=3 HEIGHT=1></TD>
    <TD width="59"> <IMG SRC="vw_imgs/interface/spacer.gif" WIDTH=59 HEIGHT=1></TD>
    <TD width="83"> <IMG SRC="vw_imgs/interface/spacer.gif" WIDTH=83 HEIGHT=1></TD>
    <TD width="49"> <IMG SRC="vw_imgs/interface/spacer.gif" WIDTH=49 HEIGHT=1></TD>
    <TD width="59"> <IMG SRC="vw_imgs/interface/spacer.gif" WIDTH=59 HEIGHT=1></TD>
    <TD width="28"> <IMG SRC="vw_imgs/interface/spacer.gif" WIDTH=28 HEIGHT=1></TD>
    <TD width="92"> <IMG SRC="vw_imgs/interface/spacer.gif" WIDTH=92 HEIGHT=1></TD>
    <TD width="1"> <IMG SRC="vw_imgs/interface/spacer.gif" WIDTH=1 HEIGHT=1></TD>
    <TD width="11"> <IMG SRC="vw_imgs/interface/spacer.gif" WIDTH=11 HEIGHT=1></TD>
    <TD width="82"> <IMG SRC="vw_imgs/interface/spacer.gif" WIDTH=82 HEIGHT=1></TD>
    <TD width="3"> <IMG SRC="vw_imgs/interface/spacer.gif" WIDTH=3 HEIGHT=1></TD>
    <TD width="17"> <IMG SRC="vw_imgs/interface/spacer.gif" width=10 HEIGHT=1></TD>
    <TD width="85"> <IMG SRC="vw_imgs/interface/spacer.gif" WIDTH=85 HEIGHT=1></TD>
    <TD width="54"> <IMG SRC="vw_imgs/interface/spacer.gif" WIDTH=54 HEIGHT=1></TD>
    <TD width="123"> <IMG SRC="vw_imgs/interface/spacer.gif" WIDTH=123 HEIGHT=1></TD>
    <TD width="3"> <IMG SRC="vw_imgs/interface/spacer.gif" WIDTH=3 HEIGHT=1></TD>
  </TR>
  <TR> 
    <TD COLSPAN=16> <IMG SRC="vw_imgs/interface/HorizontalLine.gif" WIDTH=752 HEIGHT=3></TD>
  </TR>
  <TR> 
    <TD ROWSPAN=3 Background="vw_imgs/interface/VerticalLine.gif" width="3"><IMG SRC="vw_imgs/interface/VerticalLine.gif" WIDTH=3 HEIGHT=100></TD>
    <TD COLSPAN=14 height="74"><a href="index.html"><img src="vw_imgs/tops/top.jpg" width=746 height=74 alt="VWI -Members Area" border="0"></a></TD>
    <TD ROWSPAN=3 Background="vw_imgs/interface/VerticalLine.gif" width="3"> <IMG SRC="vw_imgs/interface/VerticalLine.gif" WIDTH=3 HEIGHT=100></TD>
  </TR>
  <TR> 
    <TD colspan="14" height="2" background="vw_imgs/nav/vwi_navlo.jpg"> 
      <table width=746 border=0 cellpadding=0 cellspacing=0 background="vw_imgs/mem_nav/member_nav.jpg">
        <tr> 
          <td> <a href="m_info.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('acct','','vw_imgs/mem_nav/member_navhi_01.jpg',1)"><img src="vw_imgs/mem_nav/member_nav_01.jpg" width=89 height=26 alt="My Account" name="acct" border="0"></a></td>
          <td> <a href="m_state.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('state','','vw_imgs/mem_nav/member_navhi_02.jpg',1)"><img src="vw_imgs/mem_nav/member_nav_02.jpg" width=93 height=26 name="state" border="0" alt="my Statement"></a></td>
          <td> <a href="m_ev_calen.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('curr_e','','vw_imgs/mem_nav/member_navhi_03.jpg',1)"><img src="vw_imgs/mem_nav/member_nav_03.jpg" width=126 height=26 name="curr_e" border="0" alt="Current Events"></a></td>
          <td> <a href="m_curr_publ.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('curr_p','','vw_imgs/mem_nav/member_navhi_04.jpg',1)"><img src="vw_imgs/mem_nav/member_nav_04.jpg" width=111 height=26 name="curr_p" border="0" alt="Currnet Publications"></a></td>
          <td> <a href="m_vendor.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('vendor_i','','vw_imgs/mem_nav/member_navhi_05.jpg',1)"><img src="vw_imgs/mem_nav/member_nav_05.jpg" width=105 height=26 name="vendor_i" border="0" alt="Vendor Information"></a></td>
          <td> <a href="m_links.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('link','','vw_imgs/mem_nav/member_navhi_06.jpg',1)"><img src="vw_imgs/mem_nav/member_nav_06.jpg" width=60 height=26 name="link" border="0" alt="Links"></a></td>
          <td> <a href="m_contact.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('contact','','vw_imgs/mem_nav/member_navhi_07.jpg',1)"><img src="vw_imgs/mem_nav/member_nav_07.jpg" width=79 height=26 name="contact" border="0" alt="Contact Us"></a></td>
          <td> <a href="javascript:conFirm();" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('logout','','vw_imgs/mem_nav/member_navhi_08.jpg',1)"><img src="vw_imgs/mem_nav/member_nav_08.jpg" width=83 height=26 alt="Log Out" border="0" name="logout"></a></td>
        </tr>
      </table>
    </TD>
  </TR>
  <TR> 
    <TD COLSPAN=14 align="left" valign="top" height="135"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="112" height="13"> 
            <table width="4%" border="0" cellspacing="0" cellpadding="0" height="8">
              <tr> 
                <td width="93%" background="vw_imgs/interface/SubPLeftBGD.gif"><img src="vw_imgs/interface/SubPLeftBGD.gif" alt="" width="135" height="13"></td>
                <td width="7%"><img src="vw_imgs/interface/SubPPLeft.gif" width="19" height="13"></td>
              </tr>
            </table>
            
          </td>
          <td background="vw_imgs/interface/SubPDropShadow.gif" width="602"><img src="vw_imgs/interface/SubPDropShadow.gif" width="1" height="13"></td>
        </tr>
        <tr> 
          <td background="vw_imgs/interface/SubPPLeftBack.gif" align="left" valign="top" width="112"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="SubLinkText" align="left">
              <tr> 
                <td width="8"><img src="vw_imgs/interface/spacer.gif" alt="" width="8" height="8"></td>
                <td width="241">
                  <div align="center"><img src="vw_imgs/leftmen/quick.jpg" alt="" width="114" height="19"><br>
                    <img src="vw_imgs/interface/spacer.gif" alt="" width="40" height="4"></div>
                </td>
              </tr>
              <tr> 
                <td colspan="2" height="6"> 
                  <table border=0 cellpadding=0 cellspacing=0 width=99% class="index">
                    <tr> 
                      <td  colspan="2" height="2"> 
                        <div align="center"><img src="vw_imgs/interface/spacer.gif" width=50 height=1 vspace=0 hspace=0></div>
                      </td>
                    </tr>
                    <tr bgcolor="#FFFFFF"> 
                      <td  colspan="2"> 
                        <div align="center"><img src="vw_imgs/interface/spacer.gif" width=50 height=1 vspace=0 hspace=0></div>
                      </td>
                    </tr>
                    <tr> 
                      <td valign="top" width=16 height="2"> <img src="vw_imgs/icons/arrow.gif" border=0 width="12" height="8" vspace="2" hspace="2"></td>
                      <td width=136 height="2"> <font><a class="index" href="m_new_user.htm" >Join 
                        VWI Today</a></font></td>
                    </tr>
                    <tr> 
                      <td  colspan="2"> 
                        <div align="center"><img src="vw_imgs/interface/spacer.gif" width=50 height=1 vspace=0 hspace=0></div>
                      </td>
                    </tr>
                    <tr> 
                      <td colspan="2" bgcolor="#FFFFFF"><img src="vw_imgs/interface/spacer.gif" width=50 height=1 vspace=0 hspace=0></td>
                    </tr>
                    <tr> 
                      <td valign="top" width="16"> <img src="vw_imgs/icons/arrow.gif" border=0 width="12" height="8" vspace="3" hspace="2"></td>
                      <td width="136"> <font><a class="index" href="m_log.htm"><font color="CC6600">Member 
                        Log-in </font></a></font></td>
                    </tr>
                    <tr> 
                      <td  colspan="2"> 
                        <div align="center"><img src="vw_imgs/interface/spacer.gif" width=50 height=1 vspace=0 hspace=0></div>
                      </td>
                    </tr>
                    <tr> 
                      <td colspan="2" bgcolor="#FFFFFF"><img src="vw_imgs/interface/spacer.gif" width=50 height=1 vspace=0 hspace=0></td>
                    </tr>
                    <tr> 
                      <td valign="top" width="16"> <img src="vw_imgs/icons/arrow.gif" border=0 width="12" height="8" vspace="3" hspace="2"></td>
                      <td width="136"> <font><a class="index" href="../vendor_area/index.html">Vendor 
                        Log-in</a></font></td>
                    </tr>
                    <tr> 
                      <td  colspan="2"> 
                        <div align="center"><img src="vw_imgs/interface/spacer.gif" width=50 height=1 vspace=0 hspace=0></div>
                      </td>
                    </tr>
                    <tr> 
                      <td colspan="2" bgcolor="#FFFFFF"><img src="vw_imgs/interface/spacer.gif" width=50 height=1 vspace=0 hspace=0></td>
                    </tr>
                  </table>
                  <div align="center"><img src="vw_imgs/interface/spacer.gif" alt="" width="40" height="8"><br>
                    <a href="javascript:history.go(-1)"><img src="vw_imgs/leftmen/previous.jpg" alt="" width="114" height="19" border="0"><br>
                    </a> 
                    <br>
                    <a href="../main_area/home.htm"><img src="vw_imgs/main_vwi.gif" alt="" width="118" height="19" border="0"><br>
                    <br>
                    </a><a href="../vendor_area/b_vendor.htm"><img src="vw_imgs/interface/vwant.gif" alt="submit" border="0" align="absmiddle" width="77" height="152"></a><a href="../main_area/home.htm"><br>
                    </a> </div>
                </td>
              </tr>
            </table>
          </td>
          <td bgcolor="#FFFFFF" align="left" valign="top" width="602"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="8">
              <tr>
                <td> 
                  <table width="100%" border="0" cellspacing="1" cellpadding="1">
                    <tr> 
                      <td width="61%"><img src="vw_imgs/titles/m_log.jpg" width="120" height="18" align="middle" alt="Company History"><img src="vw_imgs/titles/TitleSpots.gif" width="63" height="13" align="absmiddle" alt="dots"></td>
                      <td width="39%">&nbsp;</td>
                    </tr>
                    <tr> 
                      <td class="BodyText" width="61%">Register online to access 
                        VWI member information. <br>
                        <br>
                        <br>
                        <b>Are you a member?</b> <i>Do you wish to join?</i> <a href="m_new_user.htm"><img src="vw_imgs/buttons/join.gif" alt="submit" border="0" align="absmiddle" width="63" height="14"></a></td>
                      <td width="39%"> 
                        <form name="member_loginform" method="post" action="">
                          <div align="center">
                            <input type="text" name="login2" value="Login Here" size="15" maxlength="35" class="BodyText">
                            <br>
                            <br>
                            <input type="text" name="password" value="Password" size="15" maxlength="35" class="BodyText">
                            <br>
                            <br>
                            <a href="#" onclick="submit"><img src="vw_imgs/buttons/submit.gif" alt="submit" border="0"></a> 
                          </div>
                        </form>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
            
          </td>
        </tr>
      </table>
    
  </TR>
  <TR> 
    <TD COLSPAN=16 height="2"> <img src="vw_imgs/interface/footerLeft.gif" width="4" height="22"><img src="vw_imgs/interface/footerMid.gif" width="218" height="22"><img src="vw_imgs/interface/footerMid.gif" width="101" height="22"><img src="vw_imgs/interface/footerMid.gif" width="203" height="22" border="0"><img src="vw_imgs/interface/footerMid.gif" width="117" height="22"><img src="vw_imgs/interface/footerCopyright.gif" width="101" height="22"><img src="vw_imgs/interface/footerRight.gif" width="8" height="22"></TD>
  </TR>
  <TR> 
    <TD COLSPAN=16> <IMG SRC="vw_imgs/interface/Layout_29.gif" WIDTH=752 HEIGHT=3></TD>
  </TR>
</TABLE>
<br>
<table width="738" border="0" cellspacing="0" cellpadding="0" align="center" height="8" class="BodyTextSmall">
  <tr> 
    <td height="2"> 
      <div align="center"><a href="[URL unfurl="true"]http://www.csconsult.com/"[/URL] target="_blank">ASP 
        code by Computer Software Consultants:<img src="vw_imgs/art/newid.gif" alt="newid" width="28" height="16" border="0" align="absmiddle"></a> 
      </div>
    </td>
    <td height="2"> 
      <div align="center"><a href="[URL unfurl="true"]http://www.designedimage.com"[/URL] target="_blank">Site 
        Designed by Designed Images:<img src="vw_imgs/art/newid.gif" alt="newid" width="28" height="16" border="0" align="absmiddle"></a> 
      </div>
    </td>
  </tr>
  <tr> 
    <td height="2"><img src="vw_imgs/interface/spacer.gif" width=400 height=1 alt="spacer"></td>
    <td height="2"><img src="vw_imgs/interface/spacer.gif" width=360 height=1 alt="spacer"></td>
  </tr>
</table>
</BODY>
</HTML>

and here is the current javascript
Code:
function conFirm() {
if (confirm("Are you sure you want\nto logout of our site?\n\nWe're really sorry to\nhave you leave us.   (VWI Staff)") ) 
{
parent.location='../index.html';
alert("GoodBye for now");
}
}

idaryl
idface.gif
 
still works fine for me.

make sure your .js file does NOT include <script> and </script> tags.

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
tested with the new one - that's what you want, right?


=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
 
don't know what to say...it works fine for me as-is, with the new js.


=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top