JavaScript - Automatically Changing Text Daily Code
I work at a college radio station and our brand new website just went live, but we're having one particular issue...
We have a set list of shows that air each day, and on the site we have a marquee tag on the homepage that scrolls through showing each show and its broadcast time. Right now we're stuck changing this schedule each day by hand, but it's tough considering we're all college students ourselves and sometimes our own schedules simply don't allow the time. Is there a code that would allow this kind of a daily update to happen automatically? The format for the schedule is such: 4 - 5 pm // "Show 01" 5 - 6 pm // "Show 02" 6 - 8 pm // "Show 03" 8 - 10 pm // "Show 04" 10 - 12 am // "Show 05" Any help would be very much appreciated! Similar TutorialsGreetings. I am trying to create an "image of the day" for a site where the image will change automatically every 24 hours. Currently, I have 30 images in a folder named "petday" (no quotes) and I tried the following code (found in this forum) but I cannot get it to work. Any help or suggestions would be greatly appreciated. On a side note, I am very new to JavaScript and I know there is an easier way to write this but I am not real clear on how to do it. I have been reading the lessons found at W3 schools and I think I can use a switch statement? Is that correct? Code: <SCRIPT Language="JavaScript"> var now = new Date(); var dd = now.getDate(); if (dd==1) document.write('<img src="petday/image1.jpg">'); else if (dd==2) document.write('<img src="petday/image2.jpg">'); else if (dd==3) document.write('<img src="petday/image3.jpg">'); else if (dd==4) document.write('<img src="petday/image4.jpg">'); else if (dd==5) document.write('<img src="petday/image5.jpg">'); else if (dd==6) document.write('<img src="petday/image6.jpg">'); else if (dd==7) document.write('<img src="petday/image7.jpg">'); else if (dd==8) document.write('<img src="petday/image8.jpg">'); else if (dd==9) document.write('<img src="petday/image9.jpg">'); else if (dd==10) document.write('<img src="petday/image10.jpg">'); else if (dd==11) document.write('<img src="petday/image11.jpg">'); else if (dd==12) document.write('<img src="petday/image12.jpg">'); else if (dd==13) document.write('<img src="petday/image13.jpg">'); else if (dd==14) document.write('<img src="petday/image14.jpg">'); else if (dd==15) document.write('<img src="petday/image15.jpg">'); else if (dd==16) document.write('<img src="petday/image16.jpg">'); else if (dd==17) document.write('<img src="petday/image17.jpg">'); else if (dd==18) document.write('<img src="petday/image18.jpg">'); else if (dd==19) document.write('<img src="petday/image19.jpg">'); else if (dd==20) document.write('<img src="petday/image20.jpg">'); else if (dd==21) document.write('<img src="petday/image21.jpg">'); else if (dd==22) document.write('<img src="petday/image22.jpg">'); else if (dd==23) document.write('<img src="petday/image23.jpg">'); else if (dd==24) document.write('<img src="petday/image24.jpg">'); else if (dd==25) document.write('<img src="petday/image25.jpg">'); else if (dd==26) document.write('<img src="petday/image26.jpg">'); else if (dd==27) document.write('<img src="petday/image27.jpg">'); else if (dd==28) document.write('<img src="petday/image28.jpg">'); else if (dd==29) document.write('<img src="petday/image29.jpg">'); else if (dd==30) document.write('<img src="petday/image30.jpg">'); </SCRIPT> How are you guys? Is there a possible thing? I've got 16 pages, one for each of 16 days. Then I've got index page. Where will be mine usual stuff but I want to add 16 visible buttons and under each button will be its content, let say for example a picture with some text. I need automatically when user open mine index for example 3rd to show 3rd picture with some text. Is that possible? To be more specific. I need some content to be automatically changed from 1st of January 2010 to 17th of January 2010. I work at a bar in Louisiana and have been put in charge of the website. Every day (Sun-Sat) we update the main page with who is bartending that night, along with a few other edits. I don't come into the office until 2pm, Mon-Fri. I would really prefer if the website could be updated 'automatically' at like, 4am or something, every day. Instead of me struggling to figure out how I'll update it on weekends. I have to use FrontPage, so I'm limited in the types of codes I can use. But Javascript seems to work well. What I'm thinking is have an 'updates' folder with pages labeled either by weekday (sunday.html monday.html tuesday.html, etc) or by date (072410.html, 072510.html, etc). Then the main page having some code that pulls from those files. (I'd prefer the weekday setup if I have the option) Since the bar doesn't close until 2am most days, I'd rather not have it change over at exactly midnight, but I'm willing to work with that if it means I know it's being updated every day regularly. Hi guys, it's a bit of a large question but I've been messing around with code for a while, and nothing seems to work... Basically, I need to make, a 'dynamic theme changer'. Basically what I need to do is have several drop down boxes, each one with some colours available as options. When you select one, it automatically (without refreshing the page) updates a certain element's style. For example, if you selected green as one colour and red as another, the element linked to the first drop-down would turn green, and the element linked to the second drop-down would turn red, and so on so forth. It then needs to have a 'save' button, which saves the settings, and adds a cookie with the style details so that when they visit the page again it's still personalized. There also needs to be a cancel button which discards all changes. I know it's a large question but I'm ripping my hair out over this one! =P Your help is much appreciated. I have a Java Script that displays a Daily Affirmation on a webpage from an array of 365 Affirmations within the same html webpage file. This makes the html file size way too large. So I would like for the java script to read the array from an external text file on the same website server. Please provide me the Code to insert within my script which will read the array from an external text file - and also the format that the array of 365 lines must be typed into the external text file. I am not a Javascript Programmer - and know nothing about Javascript, so please write your reply at my (lack of) knowledge Level. Thank you in advance! Here is the code I am using. <script language=javascript> <!-- Date.prototype.getDOY = function() {var onejan = new Date(this.getFullYear(),0,1); return Math.ceil((this - onejan) / 86400000);} var today = new Date(); var DOY = today.getDOY(); var HL=new Array() //Configure the following array to hold the 365 HLs for each day of the year HL[1]='HL 1 goes here' HL[2]='HL 2 goes here' HL[3]='HL 3 goes here' // Jump to Day 224 of the year for this example only HL[224]='I am surrounding myself with positive and supportive people. When I nurture relationships that give me energy and enjoyment, I mirror my beliefs that I deserve such gifts.' HL[225]='Today I affirm my own worth and value, and discover that the world agrees with me.' HL[226]='I am sowing seeds based on a healthy belief in my own self-worth. My life is flourishing with growing love, contentment, and exciting possibilities.' HL[227]='HL 227 goes here' HL[228]='HL 228 goes here' // Jump to last HL for Day 365 of year - for this example only HL[365]='HL 365 goes here' document.write(HL[DOY]) //--> </script> Hello there, this is my first post on this forum. I have learned a good bit of PHP and have implemented it for use in my work as a math tutor. My kids are telling me, however, that it is too inconvenient to hit tab or click on the next text box and would prefer to use the old style pencil and paper. I thought of a good idea: Javascript would be able to automatically focus the curser on the next text box if some condition was met. For example: 6+7. If the textbox reads 13, it will focus on the next text box. Otherwise, nothing happens. This kills three birds with one stone; the user will know if they got the question right or wrong and it will move automatically if they got it correct. The problem is I lack any real JavaScript wisdom. I would guess this would be quite simple. The closest thing I have found upon searching was this from the user requestcode, but this has to do with once the user has typed in 4 characters it moves automatically. Code: <SCRIPT LANGUAGE="JavaScript"> function nextbox(fldobj,nbox) { if(fldobj.value.length>3) {document.forms[0].elements[nbox].focus()} } </SCRIPT> </head> <body onLoad="document.myform.txt1.focus()"> <CENTER> <FORM NAME="myform"> <INPUT TYPE="text" NAME="txt1" SIZE="4" MAXLENGTH="4" onKeyUp="nextbox(this,1)"> Thank you for the help. I am programatically trying to send multiple emails from within javascript code. I have read forums with different ideas and have not found a true solution. The problem I am having is as follows: - in one try - i am using window.location="mailto:"+emailList - this works great if it only needs to generate 1 email, but I am doing it in a loop. when it loops through the 2nd time, it does not create a 2nd email - in a 2nd try - i am using window.open("mailto:"+emailList - this does open multiple emails, but it also opens multiple windows. I am trying to find a way to either not have the windows open (only the multiple emails) or automatically close the extra windows. I am including my code below - note - the window.location try is listed, but commented out. Any help would be appreciated. if (emailListArray.length > jsNumEmails) { var j=1; for (var i=0; i<emailListArray.length; i++) { partialEmailList = partialEmailList + ";" + emailListArray[i]; if (j == jsNumEmails) { //window.location="mailto:"+partialEmailList; window.open("mailto:"+partialEmailList, "temp", "height=5, width=5, top=0, left=0"); j = 0; partialEmailList = ""; } //if j++; }//for } // if anything left in the partial list, then send that separately if (partialEmailList != "") { //window.location="mailto:"+partialEmailList; window.open("mailto:"+partialEmailList, "temp", "height=5, width=5, top=0, left=0"); } I'm looking for code which does the following: When a visitor visits my website and clicks anywhere on the page, (regardless of where the mouse clicks) it will automatically redirect him to another site. I think an event listener might be a solution, but I'm not sure. Thanks a lot for any help on this If possible, I would like there to be a 2 second time delay before it does the redirection. Okay, I have this code, Code: <script type="text/javascript"> function changeText2(){ var userInput = document.getElementById('userInput').value; document.getElementById('boldStuff2').innerHTML = userInput; } </script> <p>Welcome to the site <b id='boldStuff2'>dude</b> </p> <input type='text' id='userInput' value='Enter Text Here' /> <input type='button' onclick='changeText2()' value='Change Text'/> A fairly simple one, and it is great, but I want to change it so that the text you type in stays there! Forever! For example, a person visits the site and types in "Hello" then the option of changing the text again disappears, and every visitor after that sees "Hello" (or whatever the first person types). Is this possible? Can anyone help me out! I am trying to change text in one cell of a table when a user selects an item from a select menu. The data for the select menu is being pulled from a database (which works fine). The select menu is displayed as expected; however the text in the div tag always comes up as "undefined" The code below is part of a PHP script (thus \" instead of ") I would like to employ a method that does not require extra Javascript in the <head> section as in this instance the code is being output from an include that is called long after the <head> area of the document is processed. Here is what I have Code: <tr><td><select name=\"race\" onchange=\"document.getElementById('ExtraInfo').firstChild.nodeValue = this.options[this.selectedIndex].extrainfo\"> <option selected=\"selected\" value=\"\">Select Race</option>\n"; $sql = mysql_query("SELECT * FROM races");$i=1; while ($row = mysql_fetch_array($sql)){ $output .= "<option value=\"$i\" ExtraInfo=\"{$row['des']}\">{$row['race']}</option>\n"; $i++; } $output .= "</select></td> <td><div id=\"ExtraInfo\">Select Race</div></td></tr> Any help will be greatly appreciated. I found a solution to my problem: by replacing: Code: <select name=\"race\" onchange=\"document.getElementById('ExtraInfo').firstChild.nodeValue = this.options[this.selectedIndex].extrainfo\"> with this: Code: <select name=\"race\" onchange=\"document.getElementById('ExtraInfo').firstChild.nodeValue = this.options[this.selectedIndex].getAttribute('extrainfo')\"> Hi, am newbie in this domain ,so i appreciate any help of you. Am making a site for tattoos and i see somewhere an application in Java for changing text, it was simple text box where you write the text you want and down you choose the Font and down you have the text you want in the wanted fond. Thank you!
Hello, I'm learning javascript and made this little program that takes the price, qty, adds tax and gives you a total. I put in an if statement so that if qty is 0, it becomes 1 then does the calcs. However, if I put in say price 5 and qty 2, qty is changing to false and it doesn't calc. Here it is: http://heresmary.com/test/Bought.html I currently have an image and underneath it there are 6 thumbnails. When I run the cursor over them the big image changes. This works fine. However, I would like to have text beside the big picture that also changes depending on the thumbnail over which I am hovering. I have tried to work it out myself but failed miserably. I have tried forums, but can't find what I need. My code as it stands at the moment is: <script type="text/javascript"> if (document.images) {image0 = new Image; image0.src = "i/p0.png"; image1 = new Image; image1.src = "i/p1.png"; image2 = new Image; image2.src = "i/p2.png"; image3 = new Image; image3.src = "i/p3.png"; image4 = new Image; image4.src = "i/p4.png"; image5 = new Image; image5.src = "i/p5.png"; image6 = new Image; image6.src = "i/p6.png"; }</script> and <img class="img" src="i/p0.png" align="left" width="300" name="rollimg" title='blah' alt="blah"/> <span class="inverse-text"><this is where I want changing text to appear as I roll over thumbnails.</span> <br clear="all"/> <span onmouseover="document.rollimg.src=image0.src;"><img src="i/tb/t0.jpg" class="img" width="70" alt="blah" title="blah"/></span> <span onmouseover="document.rollimg.src=image1.src;"><img src="i/tb/t1.gif" class="img" width="70" alt="blah" title="blah"/></span> <span onmouseover="document.rollimg.src=image2.src;"><img src="i/tb/t2.gif" class="img" width="70" alt="blah" title="blah"/></span> <span onmouseover="document.rollimg.src=image3.src;"><img src="i/tb/t3.gif" class="img" width="70" alt="blah" title="blah"/></span> <span onmouseover="document.rollimg.src=image4.src;"><img src="i/tb/t4.gif" class="img" width="70" alt="blah" title="blah"/> <span onmouseover="document.rollimg.src=image5.src;"><img src="i/tb/t5.gif" class="img" width="70" alt="blah" title="blah"/> <span onmouseover="document.rollimg.src=image6.src;"><img src="i/tb/t6.gif" class="img" width="70" alt="blah" title="blah"/> Ideally if you could tell me how to update the above script and code, so that it works, I would be very grateful. I'm taking a JavaScript class in school and we are working with forms and summary pages. We were never taught how to change the font color and bgColor when we go to the summary page after an onSubmit. Can anyone fill me in on how it is done?
I'm building a template editor and need some help changing some of the variables. Part 1. Only at DEALERNAME. Must present coupon at time of write-up. Cannot be combined with any other offer. 1 coupon per customer per transaction. Expires: 00/00/00.s I need to be able to fill out two fields to change DEALERNAME and 00/00/00. I found a way to do this but it required the output to be in a field. I need it the output to look no different than before. Part 2. I'm using this to change some text via radio button but I would like an option to select how many details are there is the first place. Say they only want 1 or 2 details and not 3. Head Code: <script language="javascript" type="text/javascript"> function detail1a(){ document.getElementById("detail1").innerHTML = "Up to 5 Quarts"; } function detail1b(){ document.getElementById("detail1").innerHTML = "Synthetic Oil Extra"; } function detail1c(){ document.getElementById("detail1").innerHTML = "Lube Chassis"; } function detail2a(){ document.getElementById("detail2").innerHTML = "Up to 5 Quarts"; } function detail2b(){ document.getElementById("detail2").innerHTML = "Synthetic Oil Extra"; } function detail2c(){ document.getElementById("detail2").innerHTML = "Lube Chassis"; } function detail3a(){ document.getElementById("detail3").innerHTML = "Up to 5 Quarts"; } function detail3b(){ document.getElementById("detail3").innerHTML = "Synthetic Oil Extra"; } function detail3c(){ document.getElementById("detail3").innerHTML = "Lube Chassis"; } </script> Body Code: <span style="font-weight: bold;">Offer Details</span><br /> <p style="margin: 8px 10px"> Detail 1<br /> <input type="radio" name="on/off" onclick="detail1a();" />Up to 5 quarts<br /> <input type="radio" name="on/off" onclick="detail1b();" />Synthetic Oil Extra<br /> <input type="radio" name="on/off" onclick="detail1c();" />Lube Chassis<br /> </p> <p style="margin: 8px 10px"> Detail 2<br /> <input type="radio" name="on/off" onclick="detail2a();" />Up to 5 quarts<br /> <input type="radio" name="on/off" onclick="detail2b();" />Synthetic Oil Extra<br /> <input type="radio" name="on/off" onclick="detail2c();" />Lube Chassis<br /> </p> <p style="margin: 8px 10px"> Detail 3<br /> <input type="radio" name="on/off" onclick="detail3a();" />Up to 5 quarts<br /> <input type="radio" name="on/off" onclick="detail3b();" />Synthetic Oil Extra<br /> <input type="radio" name="on/off" onclick="detail3c();" />Lube Chassis<br /> </p> Output Code: <ul> <li><span id="detail1">Detail 1</span></li> <li><span id="detail2">Detail 2</span></li> <li><span id="detail3">Detail 3</span></li> </ul> Hey guys, I have been trying to get better at my javascript as of late and there is this one particular color fading technique I have found that I am having trouble dissecting. The following code appears to be how they are making a rollover go from a dark gray to a subtle light gray with a nice fade but I can't exactly tell whats going on from the code. Is it just telling it to add a rgb point in so many seconds? Any professional help would be greatly appreciated. Code: colorInit= true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],0),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],0),255),0)+")"}}); HI every one i want to disallow users to change a text input values . I don't want to use disabled tag of text input because of some problem . I just want to disallow users to enter or change a text input value . How can I do so ? thanks Hi all, I hoping somebody can help me. I'm trying to acheive a line of text (with multiple links on each line) that change at set intervals. The code below seems to be working but I can only get working links on the first line that appears. Please can somebody help a gal out? xo [CODE] <html> <head> <title>Rotating Text</title> <script type="text/javascript"> var rotatingTextElement; var rotatingText = new Array(); var ctr = 0; function initRotateText() { rotatingTextElement = document.getElementById("textToChange"); rotatingText[0] = rotatingTextElement.innerHTML; rotatingText[1] = "why won't you work!?!?!?"; rotatingText[2] = "purdy please"; setInterval(rotateText, 5000); } function rotateText() { ctr++; if(ctr >= rotatingText.length) { ctr = 0; } rotatingTextElement.innerHTML = rotatingText[ctr]; } window.onload = initRotateText; </script> </head> <body> <span id="textToChange">log into your <a href="http://www.hotmail.com/">please</a> policy.</a> | can you <a href="http://www.google.com"> me?</a> </span> </body> </html> Is it possible to dynamically change the value of text on a page as the user types into a text box? E.g. like: You Are Typing: <script> var keyword = document.getElementById('string'); document.write(keyword); </script> Or I could probably insert it into a function and loop it over and over again or is there a better way? |