JavaScript - Auto Update
Hi everyone - would anyone be able to assist with a code for updating information on a daily basis?
For example, I wish to update a section of our site every day that has the following timing information: Everything is tabulated in excel and/or csv, and it also has on line pages in monthly format, but on the main index page, I just need to have a small area that provides it on a daily basis without having to go to an individual monthly page. Dawn Sunrise Mid Day Sunset Hope this make sense! In the same regard, a code that has QUOTES can also be included with daily (automatic) changes. Any help would be greatly appreciated! Thank you! Similar TutorialsHi everyone. I've managed to create everything to work correctly using javascript on my site, except I'm trying to find a way so that a certain function is called on non-stop. Or at least every time the mouse moves. The site is http://www.goformat.com/ What I'm trying to do is make it so that the words, characters, and lines counter at the top of the text area updates on its own. Right now, it updates onkeyup. However, when you click a button, to say, delete all the letters, they don't update unless you do another onkeyup action. The function that updates the words, characters, and lines is "countall()". so i tried putting a onfocus="countall()" and also a onmouseout="countall()" with one of the buttons, But none of it is working. Is there some kind of javascript code that sets the page to keep performing a function after a set amount of time? Or at least one that will work with the buttons so that the "countall()" function is called on after pushing a button? Thanks you very much everyone for the help, any suggestions are very much appreciated. Let me start by saying I am not the best in JavaScript, so any help would be much appreciated. What i am trying to do is allow a user to get a quote on how much an item would be if they wanted to sell it. all the data is being generated dynamically on the item and passed to this JavaScript correctly. The issue is when a user changes his mind and switches his options a few times the price goes out of wack and some times will actually be more then the original price. For example. If the item was in mint condition it would be 100 dollars. If it is " good condition" then it would loose lets say 20 percent, so it would be worth 80 dollars. Now each item has 3 sections of questions, what is the condition of the item, any "modifiers" like water damage or functional issues, and then third section is if its missing any parts or cables. All of this is being asked on 1 page, and when a user changes any of the options it should update the price on that page with out the user needing to press update. So condition goes, 100%, 70%, 40%, 20%. Modifiers are 50 percent of current price of item, so if it was "perfect (yes I know an item cant be perfect and have water damage but this is just an example) thus being 100 dollars, and has water damage, that would make it now worth 50 dollars, and has functional issues, now worth 25 dollars. If it was missing cables, it would loose lets say 5 dollars so now its worth 20 dollars. Thats an example on how i calculate the value of the items. So once again, the actual amount is being passed correctly to this script, but when you make to many changes its not happy. Here is the java code I have. Code: function calculateTotal(inputItem,amount1,percent1) { with (inputItem.form) { // Process each of the different input types in the form. if (inputItem.type == "radio") { // Process radio buttons. // Subtract the previously selected radio button value from the total. if (inputItem.name =="conditions") { if (percent1 ==100) { amount2= (amount1*percent1/100)-1; } if (percent1 ==70) { amount2 = (amount1*percent1/100)-2; } if (percent1 ==40) { amount2 = (amount1*percent1/100)-3; } if (percent1 ==20) { amount2 = (amount1*percent1/100)-4; } calculatedTotal.value = eval(amount2) ; } // Save the current radio selection value. previouslySelectedRadioButton.value = eval(inputItem.value); // Add the current radio button selection value to the total. calculatedTotal.value = eval(calculatedTotal.value) + eval(inputItem.value); } else { // Process check boxes. if (inputItem.checked == false) { // Item was unchecked. Subtract item value from total. if (inputItem.name =="modifiers1") calculatedTotal.value = eval(calculatedTotal.value) / eval(percent1/100); if (inputItem.name =="modifiers2") calculatedTotal.value = eval(calculatedTotal.value) / eval(percent1/100); if (inputItem.name =="extra1") calculatedTotal.value = eval(calculatedTotal.value) + eval(percent1) ; if (inputItem.name =="extra2") calculatedTotal.value = eval(calculatedTotal.value) + eval(percent1) ; if (inputItem.name =="extra3") calculatedTotal.value = eval(calculatedTotal.value) + eval(percent1); if (inputItem.name =="extra4") calculatedTotal.value = eval(calculatedTotal.value) + eval(percent1) ; } else { // Item was checked. Add the item value to the total. if (inputItem.name =="modifiers1") calculatedTotal.value = eval(calculatedTotal.value) * eval(percent1/100); if (inputItem.name =="modifiers2") calculatedTotal.value = eval(calculatedTotal.value) * eval(percent1/100); if (inputItem.name =="extra1") calculatedTotal.value = eval(calculatedTotal.value) - eval(percent1); if (inputItem.name =="extra2") calculatedTotal.value = eval(calculatedTotal.value) - eval(percent1); if (inputItem.name =="extra3") calculatedTotal.value = eval(calculatedTotal.value) - eval(percent1); if (inputItem.name =="extra4") calculatedTotal.value = eval(calculatedTotal.value) - eval(percent1); } } // Total value should never be less than 0. if (calculatedTotal.value < 0) { InitForm(); } // Return total value. return(formatCurrency(calculatedTotal.value)); } } // Format a value as currency. function formatCurrency(num) { num = num.toString().replace(/\$|\,/g,''); if(isNaN(num)) num = "0"; sign = (num == (num = Math.abs(num))); num = Math.floor(num*100+0.50000000001); cents = num%100; num = Math.floor(num/100).toString(); if(cents<10) cents = "0" + cents; for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) num = num.substring(0,num.length-(4*i+3)) + ',' + num.substring(num.length-(4*i+3)); return (((sign)?'':'-') + '$' + num + '.' + cents); } // This function initialzes all the form elements to default values. function InitForm() { // Reset values on form. document.selectionForm.total.value='$0'; document.selectionForm.calculatedTotal.value=0; document.selectionForm.previouslySelectedRadioButton.value=0; // Set all checkboxes and radio buttons on form to unchecked. for (i=0; i < document.selectionForm.elements.length; i++) { if (document.selectionForm.elements[i].type == 'checkbox' | document.selectionForm.elements[i].type == 'radio') { document.selectionForm.elements[i].checked = false; } } } <!-- Paste this code into the HEAD section of your HTML document </script> Any help would be greatly appreciated. Hello, I don't know if this can be done in Javascript, or requires any other language but i was wondering if this would be possible. I would like to embed this Javascript code in to a PHP file and then for it to run automatically upon the PHP file loading: Code: <td class="smallDesc"> <a name="fb_share" type="button_count" href="http://www.facebook.com/sharer.php">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script> </td> The Javascirpt is the Facebook Share button that basically allows users that have Facebook to share the page there currently on in their Facebook status by pressing the button, but if there not logged in it shows the login page, not a problem just continue the script. The current button i which is what i want to load automatically in the PHP file is located here, to test the functionalilty just click "Share" button in blue.. http://watch-movies-online.anyfilman...-Movie-17.html To summarise, i would like the above Javascript code to execute automatically upon pageload of this PHP file.. http://www.watch-movies-online.anyfi...p://google.com. If that could be done, and if this also is possible.. i would like for the "Share" button on the external page that is loaded from the Javascript code above to be clicked automatically so in effect when ever someone visits the PHP page after clicking "Click Here to Watch/Stream 2012 Online For Free" on this page it will automatically load the Facebook Share box, and automatically click the "Share" Button and then close the page if possible, but not required. Please feel free to ask any questions, i'll be happy to answer. Thanks in advance. Best Regards, Jonathan. I need help adding an auto scrolling feature (such as this http://www.brownielocks.com/autoscroll1.html) to an object on my website (see www.mymcgillmisa.com) I've tried (with no results) to get it to scroll, but maybe some experienced coders can help Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head><title></title></head><body><div style="width:320px; height:360px; overflow:auto;"> <p style="font: 13pt/20pt Garamond, Georgia, serif;color:#191919;"> <b> NEWS AND ANNOUNCEMENTS</b> </p> <p style="color:#191919; font-style:normal; font-variant:normal; line-height:20pt; font-size:13pt; font-family:Garamond, Georgia, serif"> <b>WELCOME BACK </b></p> <p style="color:#191919; font-style:normal; font-variant:normal; line-height:20pt; font-size:13pt; font-family:Garamond, Georgia, serif"> MISA has big plans for you this year, so stay tuned and check back here often. We plan on keeping you as up to date as possible with events relevant to you this year.</p> <p style="color:#191919; font-style:normal; font-variant:normal; line-height:20pt; font-size:13pt; font-family:Garamond, Georgia, serif"> <b>MISA Rep Selection 09</b></p> <p style="color:#191919; font-style:normal; font-variant:normal; line-height:20pt; font-size:13pt; font-family:Garamond, Georgia, serif"> <b>3</b> representatives will be chosen by the executive council for each year (U1, U2, & U3) , if you are interested in applying please check your McGill e-mail or <a href="http://www.sendspace.com/file/60yyn4">click here</a> for information.</p> <p style="color:#191919; font-style:normal; font-variant:normal; line-height:20pt; font-size:13pt; font-family:Garamond, Georgia, serif"> <b>Intramural Sports Teams</b></p> <p style="color:#191919; font-style:normal; font-variant:normal; line-height:20pt; font-size:13pt; font-family:Garamond, Georgia, serif"> The possible teams a Basketball, Ball Hockey, Dodgeball, Flag Football, Ice Hockey, Outdoor Soccer, Ultimate, & Volleyball. Teams will be formed based on the number of people interested. Please send an email from your McGill email to <a href="mailto:mimmsports@gmail.com">mimmsports@gmail.com</a> with a subject header of the sport (s) you wish to play. All requests must be sent in by Friday September 11th to be considered.</p> <p style="color:#191919; font-style:normal; font-variant:normal; line-height:20pt; font-size:13pt; font-family:Garamond, Georgia, serif"> <b>ROYAL FLUSH:</b></p> <p style="color:#191919; font-style:normal; font-variant:normal; line-height:20pt; font-size:13pt; font-family:Garamond, Georgia, serif"> Casino night fundraiser for the Crohn's and Colitis Foundation of Canada at Suco on St-Laurent on <b>Sept 11 @ 9PM </b> feat. DJ Alexei Sopin, Burlesque and Sexy Bollywood dancers, poker, blackjack, roulette, and prizes! Cocktail Dress Code. <a href="http://www.royalflush.yolasite.com">www.royalflush.yolasite.com</a> (20$)</p> </div></body></html> Any help would be appreciated thanks I need to set something up so every X amount of second on a page it goes a certain command, and keeps resetting the counter after everytime and goes again. I thought of many of the timer commands I have found on Google but didn't know if this was the RIGHT way to do it since I want it to be a document command that repeats. If what is returned to the command is true instead of false it needs to be able to change location of the browser, so I didn't know if the timer commands I found were right or not. Thanks. Hello, I'm on a RPG game and they have a automatic logout timer to stop people from using bots to play, the only problem with it is, if someone lets the timer run out, it won't let the user log back in for a time (This time could be anywhere from 5 minutes to 3 hours from what other members have told me) Now java isn't my strong point (But I'm learning ^_^) and I'm not 100% sure if this error is related to java or some other code format. Using the develop tool in Safari I was able to find the code, and its telling me thats its java, I'm sorry if this is in the wrong place if its not Java after all. I'm wondering if looking over this code, someone might be able to find the problem or might have any tips to make it work better. (Note; I'm not the admin or owner of the RPG, but the owner hasnt done anything about it mainly cause they are to lazy I think?? or might not know how to fix it. PHP Code: var c_reloadwidth3=200 var countDownTime3=countDownInterval3+1; function countDown3(){ countDownTime3--; if (countDownTime3 <=0){ countDownTime3=countDownInterval3; clearTimeout(counter3) window.location.reload() return } if (document.all) //if IE 4+ document.all.countDownText3.innerText = Math.floor(countDownTime3 / 60)+":"+(countDownTime3 % 60)+" "; else if (document.getElementById) //else if NS6+ document.getElementById("countDownText3").innerHTML= Math.floor(countDownTime3 / 60)+":"+(countDownTime3 % 60)+" " else if (document.layers){ document.c_reload.document.c_reload3.document.write('<b id="countDownText3">'+countDownTime3+' </b>') document.c_reload.document.c_reload3.document.close() } counter3=setTimeout("countDown3()", 1000); } function startit3(){ if (document.all||document.getElementById) document.write('<b id="countDownText3">'+countDownTime3+' </b>') countDown3() } For all I know it could be another script causing it to do it, but this is a start to help try and fix the problem. Thank you to anyone who helps. - zerobeat, Jack. I am wondering how i can make a page auto scroll in any direction when the mouse gets too close, i was thinking about an image following the mouse could do it <didnt work, any ideas on how i would do that? I was thinking about a broken drag and drop script, that never drops < didnt work Does anyone know of a script or has a script i could use that allows me to load a bunch of images and display only a range of them on a certain page?
I need to automate a repeated process that fills out a form and submits it automatically. Can someone lead me to the right direction on accomplishing this? - Thanks!
anyone can help me?? Code: var milisec=0 document.d.d2.value='0' function display(){ if (milisec>=9){ location.replace('javascript:chresp(1,0)'); // i want to doing auto click to this link -> javascript:chresp(1,0) } else milisec+=1 document.d.d2.value=milisec setTimeout("display()",1000) } display() can someone help me to write a code to autoclick the following codes? note that the codes are partial codes.. help me to write the solution into a script file Code 1 <table class="bgmain" width="99.75%" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"> <form method="POST" action="tvalidate.php"> <input type="hidden" name="id" size="20" value="29409"><input type="hidden" name="xfile" size="20" value="29409.pdf"> <input type="submit" value="Download" name="Enter"> </form> Code 2 <div class="smallcurve"> <div class="t"><div class="r"><div class="b"><div class="l"><div class="tl"><div class="tr"><div class="bl"><div class="br"> <div class="smallcontent"> <table width="100%" border="0" cellpadding="5" cellspacing="0" align="center"><tr><td> </ul> </td></tr></table> <center> <form method=POST action=http:blablabla.com/29409.pdf><b>Full-Text Document View/ Download :</b> <input type=image border=0 align=absmiddle src=./images/pimages.jpg title="Click here to view full- text item"> K, I've worked to create an expandable banner that starts out big, then resizes to a smaller banner once the user clicks on it. However, I want it to auto resize on it's own after 5 or so seconds. It's done with JQuery, but I don't think there is an option in jQuery to auto resize (could be wrong). Someone mentioned it could be done with javascript. But can you mix the two? Thanks for your help. Code: <script type="text/javascript"> $(document).ready(function(){ $(".flip").click(function(){ $(".panel").slideDown("slow"); $(".flip").hide(function(){ }); }); }); </script> <HEAD><TITLE>main</TITLE> <meta http-equiv="refresh" content="5;url=http://localhost/php_basic/short_pro/php/main.php"> <!--<script language="JavaScript"> var i=0; function validat() { setTimeout("moretext()",5000); alert("santosh"); } function moretext() { if(i==0) { alert(window.location); window.location.reload(); i++; } else { } } </script>--> </head> <BODY onload="validat();"> i hav written dis code to auto refresh page only once but it is refreshing after every 5 seconds. Earlier i hav wriiten meta tag but it is refreshing page after every 5 seconds & after that i hav wriiten script to auto reffresh page only once but they both r doin the same work,so can u plz help me in solvin my problem Hi there, I have found some script to auto change an image on my website, but i would like to do this in 2 other places using completely new pictures. for ease i have set up 3 cells in a table and would like them to appear in each cell. Can any body help altering my code to allow this. The code i have so far is Code: <html lang="en"> <head> <script type="text/javascript"> var c=0 var s function photoGallery() { if (c%4==0){ document.getElementById('photo-gallery').src = "boots.jpg"; } if (c%4==1){ document.getElementById('photo-gallery').src = "adidas.jpg"; } if (c%4==2){ document.getElementById('photo-gallery').src = "play.jpg"; } if (c%4==3){ document.getElementById('photo-gallery').src = "argos.jpg"; } c=c+1 s=setTimeout("photoGallery()",1000) } </script> </head> <body onLoad="photoGallery()"> <table border="1"> <tr> <td><img src="amazon.jpg" id="photo-gallery" width="420" height="260"></td> <td>another image loop here</td> <td>and another image loop here</td> </tr> </table> </body> </html> Thank you in advance I have some sample ajax code i have been toying around with. I have it updating & working properly, but you have to click a button first. How can I set it so that it automatically reads the contents of the text file on page load, and updates every 1000ms? I was trying Code: onload=setinterval(JavaScript:xmlhttpPost("status.php"),1000) but had not luck Any suggestions? Code below. PHP Code: <? $myFile = "testFile.txt"; $fh = fopen($myFile, 'r'); $theData = fread($fh, 3); fclose($fh); echo $theData; ?> Code: <html> <head> <title>Simple Ajax Example</title> <script language="Javascript"> function xmlhttpPost(strURL) { var xmlHttpReq = false; var self = this; // Mozilla/Safari if (window.XMLHttpRequest) { self.xmlHttpReq = new XMLHttpRequest(); } // IE else if (window.ActiveXObject) { self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); } self.xmlHttpReq.open('POST', strURL, true); self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); self.xmlHttpReq.onreadystatechange = function() { if (self.xmlHttpReq.readyState == 4) { updatepage(self.xmlHttpReq.responseText); } } self.xmlHttpReq.send(getquerystring()); } function getquerystring() { var form = document.forms['f1']; var word = form.word.value; qstr = 'w=' + escape(word); // NOTE: no '?' before querystring return qstr; } function updatepage(str){ document.getElementById("result").innerHTML = str; } </script> </head> <body> <form name="f1"> <p>word: <input name="word" type="text"> <input value="Go" type="button" onclick='JavaScript:xmlhttpPost("status.php")'></p> <div id="result"></div> </form> </body> </html> I'm trying to write a bookmarklet to automatically follow a specific link on a page without manually clicking or selecting the link. It's for the Facebook game Hatchlings. Each time I view someone's page to collect an egg, it has the following text: You found an egg! Add it to your basket. "Add it to your basket." is the clickable link, but has a different URL embedded in it each time I visit the page. Is there a way to create a bookmarklet to strip out the embedded URL and go to the link without actually clicking on "Add it to your basket." ? Thanks in advance for the help. I am not a programmer, so there is a problem need help. Below, how this can be achieved it(here)? thanks in advance!! Code: <ul id="nav"> <li><a href="#1">his is a long piece of text which will need to be truncated.</a></li> <li><a href="#2">This is a long piece of text which will need to be truncated.</a> <ul><li><a href="#">This is a long piece of text which will need to be truncated.</a></li> <li><a href="#">This is a long piece of text which will need to be truncated.</a> <ul><li><a href="#">This is a long piece of text which will need to be truncated.</a></li> <li><a href="#">This is a long piece of text which will need to be truncated.</a> <ul><li><a href="#">This is a long piece of text which will need to be truncated.</a></li> <li><a href="#">This is a long piece of text which will need to be truncated.</a> <ul><li><a href="#">This is a long piece of text which will need to be truncated.</a></li> <li><a href="#">This is a long piece of text which will need to be truncated.</a></li> </ul> </li> </ul> </li> </ul> </li> </ul> </li> <li><a href="#3">This is a long piece of text which will need to be truncated.</a></li> <li><a href="#4">This is a long piece of text which will need to be truncated.</a></li> <li><a href="#5">This is a long piece of text which will need to be truncated.</a></li> </ul> Hi all, I am newbie to JS. I have the below task. Please advise. I have a result set of a query being displayed on a page. (5000+ rows). I have to provide a search capability, a search box which will enable to enter a position ID number and the entered position ID by the user should be selected from the results in a different color. Can you please help me with the above. Thanks in advance Hey guys i have been fighting with this issue for some time so I figured i would join this forum and ask for some help for once. Here is what i am trying to accomplish. I have a drop down menu in place to select a month and a year for our owners to select and check their availability calendar. The issue is that i am tired of every month/year going into the code to change the preselected month/year setup less i hear screaming to high heaven from the owners that "The month isnt the current month" constantly. Here is the code i am currently using. <p align="left"><font face="Verdana"> <!--webbot bot="Validation" b-value-required="TRUE" b-disallow-first-item="TRUE" --> <select size="1" name="arrivemonth" value="%%arrivemonth%%"> <option>Select Month</option> <option value="01" SELECTED>January</option> <option value="02">February</option> <option value="03">March</option> <option value="04">April</option> <option value="05">May</option> <option value="06">June</option> <option value="07">July</option> <option value="08">August</option> <option value="09">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select></font></TD> </TR> <TR> <TD bordercolorlight="#808080" bordercolordark="#808080"> <font face="Verdana"> <!--webbot bot="Validation" b-value-required="TRUE" b-disallow-first-item="TRUE" --><select size="1" name="arriveyear" value="%%arriveyear%%"> <option>Select year</option> <option value="2004">2004</option> <option value="2005">2005</option> <option value="2006">2006</option> <option value="2007">2007</option> <option value="2008">2008</option> <option value="2009">2009</option> <option value="2010" SELECTED>2010</option> <option value="2011">2011</option> </select> All i am trying to accomplish is a code that will check the current month and year then preselect the value in the drop down automatically. This information is then fed to a .CGI script to pull data from our local server for their condo availability. Any ideas anyone? hi, can someone help me create an auto pro rata calculator where there are four [4] boxes. first box should be where we could enter the customer's plan [29,39,40 etc.] and it should be divided with what ever i will enter on the second box w/c will be for the number of days in a month [28,29,30,31]. the 3rd box should be where i can enter the number of days the cust. was able to use the service and it needs to be multiplied from box 2. 4th box should be a read only box where the pro rata will be displayed. so: [box 1] divided "/" by [box 2] multiplied "*" by [box 3] equals "=" to box four thanks!!! |