Google Answers Logo
View Question
 
Q: 3 JavaScript Questions - random frame page content, submit once only, form timer ( No Answer,   0 Comments )
Question  
Subject: 3 JavaScript Questions - random frame page content, submit once only, form timer
Category: Computers > Programming
Asked by: cclegg06-ga
List Price: $15.00
Posted: 26 Mar 2003 07:47 PST
Expires: 26 Mar 2003 12:10 PST
Question ID: 181152
Three JavaScript Questions…

#1
I have a frame index page with three frames.  I would like the middle
frame (main) to present a random page each time a new visitor visits the page.

So far I have:

<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>New Page 1</title>

<script language="javascript" src="../../js/qxDelivery.js"> </script>

</head>

<body oncontextmenu="return false" 
      onload="javascript:chooseSurvey();">

</body>

</html>


// WINDOW DIMENSIONS //  
function qxDisplay(url)  
{  
 newwindow=window(url,'name','scrollbars=yes');

}  
 
 
// SURVEY FUNCTION //  
function chooseSurvey() 
{  
  var aRandom_number = Math.random();  //Random Number Generation  
  if (aRandom_number <= 1.0)                 //Incident Rate = 100%
  {  
      
    // INITIALIZE VARS  
    var survey = new Array();                 // Survey is an array of
URLs
    var number = 0;  
 
    // SET THE URLS 
    survey[number++] = "../content/surveys/cs-1.htm";
    survey[number++] = "../content/surveys/cs-2.htm";
    survey[number++] = "../content/surveys/cs-3.htm";
    survey[number++] = "../content/surveys/isp-1.htm";
    survey[number++] = "../content/surveys/isp-2.htm";
    survey[number++] = "../content/surveys/isp-3.htm";
  
    // RANDOMLY SELECT ONE OF THE ABOVE PAGE LOCATIONS
    var increment = Math.floor(Math.random() * number);  
 
    // CALL THE POPUP WINDOW FUNCTION 
    qxDisplay(survey[increment]);     
 
  }                                                  // end if 
 
// END FUNCTION 
}


It doesn’t seem to work.  Can anyone help?

#2

I would like to prevent someone from hitting the “submit” button more
than once and thus double submitting the form.  Can you provide a
simple JavaScript solution for this?

#3

I would like to initiate a timer that counts how long a person is on a
form from the time they answer the first question until the time they
hit submit.  I would then like to send the resulting time as a hidden
variable to the form database.  Can you provide a simple JavaScript
solution for this?


Thank you for your time,

Chris Clegg
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy