JavaScript - Checking If User Refreshed A Page
Hey,
Is there a method to check if a user refreshed a page? I'm designing an online psychological experiment and I want to see if the user refreshed a page (to see if he was trying to see an image that he was supposed to see only once). Thanks, Similar Tutorialshello. I have several switch menus that are VITAL to my website's navigation. They all worked very well when I tested the pages in all browsers. However, I finally FTPed my site to the internet, now when you click a link from a switch menu, instead of staying opened due to the onLoad function in the body, they do not appear. Strangely, the only way to get my switch menus to show is to refresh the page. Suggestions? Is there coding to force the page to refresh to look the way I want it? thanks see website he www.jingspa.com ignore the first menu link, it's different. notice how you go to a section and the menu closes when you click on something? hit refresh, and the menu will be there... _________
Hi, Two JS questions: 1. Is there a way to check (using JS only) if the user have local admin privileges on the local machine? 2. Is there a way to check (using JS only) if office 2007 or office 2007 compatibility pack is installed on the local machine? Thanks, Yotam Ok, im stuck. Ive tryed about 10 solutions from Google. None are working. Ok, I made a site in Flash, and a second site in HTML. I want to automatically redirect people from my flash site (indexhigh.html) to my html site (indexlow.html) if they can't see my flash movie. Here's the flash page URL: http://testnewsite.netau.net/indexhigh.html . Restrictions: This redirect MUST be done using javascript or without having me to download another swfobject file. Please paste completed code. Heres my current code: Code: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Website</title> <script language="javascript">AC_FL_RunContent = 0;</script> <script src="AC_RunActiveContent.js" language="javascript"></script> </head> <body bgcolor="#ffffff"> <!--url's used in the movie--> <!--text used in the movie--> <!-- saved from url=(0013)about:internet --> <script language="javascript"> if (AC_FL_RunContent == 0) { alert("This page requires AC_RunActiveContent.js."); } else { AC_FL_RunContent( 'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0', 'width', '940', 'height', '940', 'src', 'Website', 'quality', 'high', 'pluginspage', 'http://www.macromedia.com/go/getflashplayer', 'align', 'middle', 'play', 'true', 'loop', 'true', 'scale', 'showall', 'wmode', 'window', 'devicefont', 'false', 'id', 'Website', 'bgcolor', '#ffffff', 'name', 'Website', 'menu', 'true', 'allowFullScreen', 'false', 'allowScriptAccess','sameDomain', 'movie', 'Website', 'salign', '' ); //end AC code } </script> <noscript> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="940" height="940" id="Website" align="middle"> <param name="allowScriptAccess" value="sameDomain" /> <param name="allowFullScreen" value="false" /> <param name="movie" value="Website.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /> <embed src="Website.swf" quality="high" bgcolor="#ffffff" width="940" height="940" name="Website" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object> </noscript> <table width="889" border="2" cellspacing="0" cellpadding="0"> <tr> <td width="91" bgcolor="#FFFFFF">Site created by:</td> <td width="232"><a href="http://www.christoff.tk"><img src="my_Logo.png" width="197" height="169"></a></td> <td width="242"><a href="http://www.fcw.comoj.com"><img src="logo3.JPG" width="205" height="62"><br> Free Charity Websites </a></td> <td width="112">And by the</td> <td width="198"><p><img src="untitled.png" width="77" height="86"><br> Fort Myers High School <br> Web Design 2 Students from<br> 1st Period<br> Team leader: Chris Christoff </p></td> </tr> </table> </body> </html> Chris Hi, Can anyone please tell me that " how to write a JavaScript function to pop up an alert() if a user scrolls down the webpage faster than a certain speed" Looking forward for a urgent reply Thanks Hi there guys! My group is working on a basic document management system that includes four users. staff member, department director, division chief and clerk. The programming language that we used is PHP. when staff member logs-in on his homepage and uploads a file he must choose reviewer from a dropdown menu that consists of dep. director and div. chief. When he clicks the upload button the homepage of who he chose as reviewer should receive a prompt/alert box upon log-in saying "you have a document to review". For example: if he chose division chief as the reviewer when the person logs-in on his homepage a prompt/alert should display that he has something to review. The code for uploading file is already up and working. We are looking for advice on how to integrate javascript in this system. Especially in the prompt part. thanks for your ideas. our requirement is client wants to know howmany users leaving the main page without entering data in the application page.at that time we need to show the css popup overlay. in the following scenarios overlay should pop up. 1)when user leaves the page.(e.g. type other address in the address bar).bascially user shy away from the browser. 2)clicks browser close button. we will show one css popup overlay(not browser popup) and in the back ground main application will be greyed out.this overlay consists of some text fields and some buttons will be there and parallely in the back ground we will execute AJAX call. can we accomplish this requirement??is yes how?will it work in all browsers? my concern is how to prevent the browser from closing(e.g.when user chooses browser X button) when css overlay comes up. I'm working in iWeb (I had to say that first). I need to create (using JAVASCRIPT) a text box with a button. When the button is clicked, the contents of the box are added to the URL (the url is in the code, probably a variable, for this example it is mydomain.wordpress.com/) and the url produced loads. For example, if the text "Hello" was printed in the text box once the button is clicked the page mydomain.wordpress.com/Hello is loaded.
I wish to make a dropdown box appear when a user leaves a particular page. I have the code for the drop down and it works well. It fires when a function is called: function = initboxv2(); return false; How do I call it when the user attempts to leave the page? So that it goes direct to the dropdown (I've tried onbeforeunload and I get a dialog alert which I do not want.) Thanks I want to use javasript to create a new html page named from a text field in a form. Then I want to use javasript to copy all of the form fields to the new html page that was created using javascripting. I am creating a user are using a Javascript password login. With most of them the page is the user name or password. So this is why I am looking to do this. I use web 1000 a free host and they will only let me use javascripting. Any info or help would be great thank you
How could I open a page/popup after closing one? The objective is to log the user out if they haven't Logged out or clicked Logout. I am sure there is a simple way to do this. None of my ideas work. The only answer I could come with (after testing the whole day...) IE(any version), Firefox, and other browsers don't support this idea, due to the fact that the user clicked close and you can't impose things on them. I have a small form that I'm working on for a client. They want a form that their potential leads can fill out and then hit 'calculate rate'. Once this is done, the results should display on another page with a short summary of what their quote will be as well as some of the other information they filled out. It should also send an email to my client displaying the information that their lead just filled out. My only problem is I am not sure how to go about the calculation part. I know I would have to do an onSubmit, but how would I hide that calculation and then receive that number on another page. Here is the javascript for that form: Code: /* This source is shared under the terms of LGPL 3 www.gnu.org/licenses/lgpl.html You are free to use the code in Commercial or non-commercial projects */ //Set up an associative array //The keys represent the size of the cake //The values represent the cost of the cake i.e A 10" cake cost's $35 var practice_field = new Array(); practice_field["None"]=0; practice_field["Allergy and Immunology"]=4400; practice_field["Endocrinology"]=4400; practice_field["Pathology"]=4400; practice_field["Dermatology"]=4400; practice_field["Geriatrics"]=4400; practice_field["Physical Rehabilitation"]=4400; practice_field["Family Practice"]=6900; practice_field["General Practice"]=6900; practice_field["Internal Medicine"]=6900; practice_field["Oncology"]=6900; practice_field["Oral Surgery"]=6900; practice_field["Radiology"]=6900; practice_field["Gastroenterology"]=6900; practice_field["Infectious Disease"]=6900; practice_field["Nephrology"]=6900; practice_field["Ophthalmology"]=6900; practice_field["Pediatrics"]=6900; practice_field["Urology"]=6900; practice_field["Anesthesiology"]=9000; practice_field["Cosmetic Surgery"]=9000; practice_field["General Surgery"]=9000; practice_field["Neurology"]=9000; practice_field["Otolaryngology"]=9000; practice_field["Plastic Surgery"]=9000; practice_field["Vascular Surgery"]=9000; practice_field["Cardiology"]=9000; practice_field["Emergency Medicine"]=9000; practice_field["Gynecology"]=9000; practice_field["Orthopedic Surgery"]=9000; practice_field["Pain Management"]=9000; practice_field["Pulmonary Surgery"]=9000; practice_field["Neurological Surgery"]=9900; practice_field["Obstetrics"]=9900; //Set up an associative array //The keys represent the filling type //The value represents the cost of the filling i.e. Lemon filling is $5,Dobash filling is $9 //We use this this array when the user selects a filling from the form var society_member= new Array(); society_member["None"]=null; society_member["BCMA"]=0.10; society_member["DCMA"]=0.10; society_member["FOGS"]=0.10; society_member["FNS"]=0.10; society_member["PBCMS"]=0.10; society_member["FSPS"]=0.10; //This function finds the filling price based on the //drop down selection function getPracticeField() { var docPracticeField=0; //Get a reference to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the select id="filling" var selectedPracticeField = theForm.elements["practice"]; //set cakeFilling Price equal to value user chose //For example filling_prices["Lemon".value] would be equal to 5 docPracticeField = practice_field[selectedPracticeField.value]; //finally we return cakeFillingPrice return docPracticeField; } //This function finds the filling price based on the //drop down selection function getSelectedSociety() { var docSelectedSociety=0; //Get a reference to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the select id="filling" var selectedSociety = theForm.elements["society"]; //set cakeFilling Price equal to value user chose //For example filling_prices["Lemon".value] would be equal to 5 docSelectedSociety = society_member[selectedSociety.value]; //finally we return cakeFillingPrice return docSelectedSociety; } //candlesPrice() finds the candles price based on a check box selection function candlesPrice() { var candlePrice=0; //Get a reference to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the checkbox id="includecandles" var includeCandles = theForm.elements["includecandles"]; //If they checked the box set candlePrice to 5 if(includeCandles.checked==true) { candlePrice=0; } //finally we return the candlePrice return candlePrice; } function insciptionPrice() { //This local variable will be used to decide whether or not to charge for the inscription //If the user checked the box this value will be 20 //otherwise it will remain at 0 var inscriptionPrice=0; //Get a refernce to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the checkbox id="includeinscription" var includeInscription = theForm.elements["includeinscription"]; //If they checked the box set inscriptionPrice to 20 if(includeInscription.checked==true){ inscriptionPrice=0; } //finally we return the inscriptionPrice return inscriptionPrice; } function calculateTotal() { //Here we get the total price by calling our function //Each function returns a number so by calling them we add the values they return together var cakePrice = getPracticeField() + null - (getPracticeField() * getSelectedSociety()) + candlesPrice() + insciptionPrice(); //display the result var divobj = document.getElementById('totalPrice'); divobj.style.display='block'; divobj.innerHTML = "Your Pre-Paid Legal Defense Fee Will Be Around $"+cakePrice; } function hideTotal() { var divobj = document.getElementById('totalPrice'); divobj.style.display='none'; } If you look at the bottom you can see where the Function that Calculates everything is. Right now it calculates onClick. I just want it to calculate after the user has filled out the form completely and display that calculation on another page along with the rest of the information they inputted. Hi, Please i am not getting clear understanding of a javascript code to redirect user to a different web page based on the day of the week. Please i have search for many script and not getting clear understanding from their code.I have also try several code myself but nothing good has come from it. Please can someone help me and write a descriptive code for me to understand better.I really plead you and your to help me...but i belief the Lord God will bless you for your time helping me. looking forward to here from you. Thank you. Clement Osei On various video sites you can click cinema mode and the page goes dark, whilst you watch the video. On my page I have a box which appears, where the user enters their name and email address. But I would like the box to remain active and in view. While the rest of the page goes darker and unusable, Like on the video player websites How do I do this? I've been handed an html document that contains a centered, scrollable <iframe> element with a static height and width. This iframe element displays a simple html document that houses the 'terms of service' text. Their goal is to have it to where the <a href> link at the bottom that is shown to the user as 'next' is disabled until the user scrolls to the bottom of the terms of agreement box. The clickable link could be a button, image or text (no preference). They have to have it this way for legal reasons and radio buttons or checkboxes will not suffice unfortunately. Question: What is the best way to go about doing this that seems to be cross-browser friendly (especially IE7). I offer $10 via paypal for well commented method/script. Hi, I'm looking for help, please. I am trying to setup a donation form for a friend, where someone can click radio buttons for set donation amounts, or click the "other" radio buttons and enter a different amount. The donation amount is then passed over to a secure credit card entry page, hosted by a 3rd party merchant. I can set up all the pre-defined radio buttons to correctly pass on the donation amount to the credit card page, but I cannot figure out how to work the "other" radio button amount. Any help would be very much appreciated! Thanks! I keep getting myself into trouble because I tend to use my Java reference when coding Javascript, and of course Javascript doesn't support all Java functions. I've just discovered that apparently Javascript doesn't support the trim() function. But curiously, if I code it as: mystring.trim() then Firefox will handle it without any errors. (I haven't actually checked to see if whitespace is removed from around the string.) But when I code it like this: trim(mystring) then firefox gives an error. I've also found a couple of situations where I've made syntax errors, and Firefox gives no error message. This makes debugging tricky, since the only resource I have available is Firefox's Error Console. Safari has no error reporting whatsoever, AFAIK. MSIE seems to find some errors that Firefox misses, but I don't have MSIE on my main computer, so it's a nuisance to use. As a hobbyist, I have no budget to buy Javascript development tools. Is there something free available that does a better job of finding errors? I need to check to see if a cookie has been previously created: Code: var startnum = readCookie('a1'); if (document.cookie.indexOf('a1') == -1){ var startnum = "0"; } Should line 2 be: Code: if (document.cookie.indexOf('a1') == null){ ? Does == -1 do the same thing? I made a cool calendar application I want someone to look over it and see if I messed up anywhere cause I have a good feeling I did. It was designed to be an active desktop ^.^ that way I get my desktop image and a calendar ^.^ index.html Code: <html> <head> <title>Desktop</title> <link rel="stylesheet" type="text/css" href="css/mainTemplate.css" /> </head> <body> <img id="bgImage" src="images/nerbian-entrance.jpg" alt="Active Desktop made by Shelby Brittain" /> <table id="mainTable"> <caption id="caption"> </caption> <tr> <th> Sunday </th> <th> Monday </th> <th> Tuesday </th> <th> Wednesday </th> <th> Thursday </th> <th> Friday </th> <th> Saturday </th> </tr> <tr> <td id="d1"> </td> <td id="d2"> </td> <td id="d3"> </td> <td id="d4"> </td> <td id="d5"> </td> <td id="d6"> </td> <td id="d7"> </td> </tr> <tr> <td id="d8"> </td> <td id="d9"> </td> <td id="d10"> </td> <td id="d11"> </td> <td id="d12"> </td> <td id="d13"> </td> <td id="d14"> </td> </tr> <tr> <td id="d15"> </td> <td id="d16"> </td> <td id="d17"> </td> <td id="d18"> </td> <td id="d19"> </td> <td id="d20"> </td> <td id="d21"> </td> </tr> <tr> <td id="d22"> </td> <td id="d23"> </td> <td id="d24"> </td> <td id="d25"> </td> <td id="d26"> </td> <td id="d27"> </td> <td id="d28"> </td> </tr> <tr> <td id="d29"> </td> <td id="d30"> </td> <td id="d31"> </td> <td id="d32"> </td> <td id="d33"> </td> <td id="d34"> </td> <td id="d35"> </td> </tr> <tr> <td id="d36"> </td> <td id="d37"> </td> <td id="d38"> </td> <td id="d39"> </td> <td id="d40"> </td> <td id="d41"> </td> <td id="d42"> </td> </tr> </table> </div> <script type="text/javascript" src="js/mainLib.js"> //<![CDATA[ //]]> </script> </body> </html> css/mainTemplate.css Code: body { background-color: black; color: #C0C0FF; } caption { font-size: 24pt; } th, td { width: 100px; border: 1px solid #C0C0FF; } th { height: 25px; } td { vertical-align: bottom; text-align: right; } #bgImage { position: absolute; top: 0px; left: 0px; width: 102%; height: 103%; } #mainTable { position: absolute; top: 2%; left: 61%; border: 1px solid #C0C0FF; padding: 5px; vertical-align: top; width: 600px; height: 375px; background-color: black; opacity:0.5; filter:alpha(opacity=50); } js/mainLib.js Code: var d = new Date(); var day = d.getDate(); var wk = d.getDay(); var set = new Array(35); var j = 0; var mnth = d.getMonth(); function getMonthName() { var mth = ""; var month = new Array(12); month[0]="January"; month[1]="Febuary"; month[2]="March"; month[3]="April"; month[4]="May"; month[5]="June"; month[6]="July"; month[7]="August"; month[8]="September"; month[9]="October"; month[10]="November"; month[11]="December"; mth = month[d.getMonth()]; return mth; } function getFirstDay() { var firstDay = wk; for(var i=day-1; i>=0; i--) { firstDay--; if(firstDay == -1) { firstDay=6; } } return firstDay; } if(mnth==1 && getFirstDay()!=6) { monthLength = 28; } else if(mnth==1 && getFirstDay()==6) { monthLength = 28+6; } else if(mnth==0 || mnth==3 || mnth==5 || mnth==8 || mnth==10) { monthLength = 30+getFirstDay(); } else { monthLength = 31+getFirstDay(); } document.getElementById("caption").innerHTML = getMonthName(); if(getFirstDay()==6) { for(var i=1; i<=monthLength-6; i++) { j++; set[i] = "d"+ (i); document.getElementById(set[i]).innerHTML = j; } } else { for(var i=getFirstDay()+1; i<=monthLength; i++) { j++; set[i] = "d"+ (i + 1); document.getElementById(set[i]).innerHTML = j; } } Thanks Shelby |