Solved

Upon site exit, open new window for questionaire

Posted on 1998-05-15
3
218 Views
Last Modified: 2006-11-17
Initially, I have a splash screen load from our root url (www.mydomain.com/index.shtml) which in turn does a browser sniff and displays frames.html in a new window, which is resized according to the resolution of the surfer's monitor settings.  Frames.html displays only the page but doesn't display a menubar, button bar, address bar or a links bar (MSIE and N4).  Frames.html consists of header.html and footer.html.  Between the two is a nested set of frames that display salesmenu.html and saleshome.html.  The frames are tagged top, middle, and bottom.  When a user leaves my site, I want a questionaire to popup logout.html (I know that this irritates some, hence my later creation of a cookie that will only do this once)for them to either fill out or which they can close.  I have little experience with java so please be descriptive.  This is what I have been using.

<script language="Javascript">
<!--
var doit=true;
function exitcnsl()
{
if (doit)
open("http://www.mydomain.com");

}
//-->
</script>  


in my links I have the statement as false.


<a href="products1.html" target="middle" onclick="doit=false"> <img src="../buttons/products1.gif"
alt="prody.gif (1550 bytes)" style="color: rgb(255,255,255)" WIDTH="157" HEIGHT="24">

Can someone please explain this in great detail?

Thank you in advance
0
Comment
Question by:kpaulk
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
Trevor013097 earned 80 total points
ID: 1278152
kpaulk,

What I think you want is a window which will open when someone leaves your website.

To do this you would simply call your new window function from an onUnload which is placed in your BODY tag like this:

<BODY onUnload="myexit();">


Then in your script tag put something like this:

<SCRIPT LANGUAGE="Javascript">
<!--

function myexit() {
var newWindow;
winOpts='toolbar=no,location=no,directories=no,status=no,scrollbars=no,menubar=no,width=200,height=200';

      Urlvar = "UrlforQuestionnaire.htm";
      Questionnaire = window.open(Urlvar,'newWindow',winOpts);
}
//-->
</SCRIPT>

What I have done is split the usual window open code into more managable sections.  It set sets the URL to be loaded in one variable and the options for the window (such as toolbar on/off etc) in other variable and then opens the window pulling all the variables together.

Hope this works.  If you need any help then please ask.

Trevor.


0
 

Author Comment

by:kpaulk
ID: 1278153
Thanks Trevor.  I got this to work...but I would like to see if there are any other variables that might work.

kpaulk
0
 
LVL 5

Expert Comment

by:Trevor013097
ID: 1278154
kpaulk,

What do you mean by other variables.  Do you mean another method or changing the popup window?

Trevor.


0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now