JavaScript - Automatically Changing Page Each Day..
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. Similar TutorialsI 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! 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'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. Hi there, I have a problem that I've been scouring the internet for an answer but have been unable to find a solution and wondered if anyone could offer their assistance here? I'll try to explain my problem: On my homepage (index.html), I have a search field which fires the users input (text) parameters off to another website to perform the search (ie. results.html). What I'm now trying to do is create an iframe on index.html which shows the search results on the same page (without the user having to visit the other website. Does anyone know if this is possible using javascript? The reason behind this is so that we can use the search on our old website on our new one... without having to re-invent the wheel. Any help would be greatly appreciated! Craig Hi, Im not sure if im going about this the right way but what I'm trying to achieve is to have my webpage seperated into two main div's. The first div contains a media player so it cant be refreshed or the media stops. The second div is used to view content. I've used innerHTML to change the content of the second div from links in the first. The problem is the URL displayed doesn't reflect the change in content of the second div. I want to be able to load content into the second div using innerHTML while changing the URL so people can link directly to that content. Any help or alternative ideas are greatly apprectiated. Thanks. Dear all, I am trying to set up a web site for an art gallery. That is for new talents so I have no budget. I am not a web designer and I am facing some barriers. Maybe some of you could help me. My problem is, I guess, about going around with the DOM node tree. My page looks like this: FRAME 1 - Header FRAME 2 - Navigation bar FRAME 3 - Has arrows for scrolling iframe 3.1 ---- iframe 3.1 - has thumbnails FRAME 4 - First for query and after shows the enlarged pictures of thumbnails FRAME 5 - Has arrows for scrolling iframe 5.1 ---iframe 5.1 Has text explaining pictures in frame 4 How it works: In first place, after page has been loaded, I am using frame 4 to run a HTML form. After submit, iframe 3.1 is populated with thumbnails according to the query. When a thumbnail is clicked, I succeeded in bringing the corresponding text, talking about the artwork, on iframe 5.1 to do so, I change the html source in iframe 5.1 I am using for that: top.frames['frame5_id'].document.getElementById('iframe 5.1_id').src=new_source.html; The idea was about doing the same with the frame 4 that is for a larger picture of the artwork. But first I need to get rid of the form once it was submitted (bring a new HTML with a dummy transparent gif to be swapped with the desired picture). But how can I bring a new html in frame 4? After the form is submitted the 'action' moves to iframe 3.1 I tried changing the html source using getElementById but I could not find a way to get to the right object. So my questions a Two src attibutes must be changed with code written in iframe 3.1. (where the thumbnails are clicked). But... How can I address and change the HTML src code in FRAME 4 ? How can I address and change the src image in the new code loaded in FRAME 4 ? I have both attributes in variables but don't know how to get to the target elements Thanks for any help. regards, wagner hi, have a series of 2 pages. The first is a drop down select box that gathers the state name. Onclick we are using a window.open to open a page with a list of cities for that state. Again using a drop down select box to select the city and then, onclick, we send the user off to the appropriate page based on state/city selection while at the same time updating the 1st (parent) page with a new location.href. Problem is that instead of updating the parent page, it updates the page with the list of cities (the child page). On the first page script we generate the following warning: Warning: XUL box for _moz_generated_content_after element contained an inline #text child, forcing all its children to be wrapped in a block. Source File: chrome://browser/content/browser.xul Line: 0 First page is not generated via javascript but standard html. This happens both locally and when pages are moved to the server (Apache). First page script is as follows Code: <HTML> <HEAD> <TITLE>J1</TITLE> <SCRIPT LANGUAGE="JavaScript"> function StateSelect (form) { Item = form.state.selectedIndex; Result = form.state.options[Item].value; window.open('j2.htm?value='+ Result,'myWindow','resizeable=no,resizeable=0,scrollbars=no,scrollbars=0,location=no,location=0,toolbar=no,toolbar=0,directories=no,directories=0,menubar=no,menubar=0,status=no,status=0,copyhistory=no,copyhistory=0,width=300,height=100,left=300,top=300,screenX=300,screenY=300') } </SCRIPT> </HEAD> 2nd page (where user selects city) code is as follows: Code: <SCRIPT LANGUAGE="JavaScript"> function CitySelect (form) { Item = form.city.selectedIndex; city = form.city.options[Item].value; state = document.myform.state.value; window.open('j3.htm','mywindow3') setTimeout("Func1()",3000); } function Func1() { parent.location.href='j4.htm?st='+ state + '&city=' + city,'mywinow2'; } </SCRIPT> Ideas on why and what the error (actually a warning) is trying to tell us? Thank you all! Jim I have a lightbox pop up on my homepage. I'm curious if there's a way to automatically close the pop up after 5 seconds or so. For some readon onClose kept popping in my head, but I'm pretty sure that's not correct. Thanks. Code: !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Lightbox Example</title> </head> <body> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/ libs/jquery/1.4/jquery.min.js"></script> <script type="text/javascript" src="/lightbox/ jquery.mousewheel-3.0.4.pack.js"></script> <script type="text/javascript" src="/lightbox/ jquery.fancybox-1.3.4.pack.js"></script> <link rel="stylesheet" type="text/css" href="/lightbox/fancybox/ jquery.fancybox-1.3.4.css" media="screen" /> <script type="text/javascript"> $(document).ready(function() { $("a#onload").fancybox({ 'frameHeight': 390, 'frameWidth': 640, 'hideOnContentClick': false, 'easingIn': 2000 }).trigger('click'); }); </script> <div id="lightbox_content" style="display:none"> <div id="data"> <img src="/lightbox/donate.jpg" alt="Support Today!"> <h1>Pledge Your Support Today!!</h1> </div> </div> <a id="onload" href="#data"></a> </body> </html> hello .. i have some problem while while working on a script.. i want to use confirmation() function to confirm submit button and if its true ...then submit form... else keep on same page (thats logic) am using php as server scripting .. and i wrote ..in php PHP Code: <form action="del_cat.php\" name=\"myform\" method=\"post\"> "; Delete: <input type="submit\" name=\"delete\" onclick=\"confirmation()\" value=\"Delete\" > <br> Edit:<input type=\"submit\" name=\"edit\" value=\"Edit\" > </form>"; and used a javascript in head PHP Code: <script type="text/javascript\"> function confirmation() { var r=confirm(\"Are you ready to delete?\"); if (r==true) { document.myform.submit(); } else { alert(\"check twise before submitting \") } } </script> my problem is if i click "OK" or "Cancel" both case the form is automatically submitting ... see i used PHP Code: if (isset($_POST['delete'])) { mysql_query("DELETE FROM ********* WHERE id='{$_POST['cid']}'"); } this code to invoke the function .. Does anyone know of a good library/function that will add the commas to a number automatically as the number is entered into a field?
Hi,
I have a form in my site.when the form is submit successfully it's go to another page, which shows "submission is success".
and that page has a link to go back to a page which is viewing previously(before to form)
this is the code for it Code: <a href="javascript:history.go(-2)">Go back to previous</a> I want to know, how to go to previous page by automatically ??? this should be happen after 10 seconds! please help me.... I have a welcome message on my site and would like to automatically hide it after several seconds. I can't find anything usable after searching over the internet. Can anyone help? Thanks in advance. Is there some javascript that will make a link in a page be clicked on page load?
I have this slideshow, that twirls around but i'm trying to center it within the browser so the middle picture stays in the middle and the side pictures have about a 10px padding from the browsers border. The weird thing is that it adjusts itself when you first open the link, but if you have it open and resize your browser, it won't adjust to the width. Can't figure what i'm doing wrong. I already posted in the HTML/CSS forum but nobody could help. Thanks guys. Check it out he jonathaneiger.com Hi, I am trying to write a script to get my sprite to move to the next row once it reaches the last frame on it's current row. Here's my attempt so far; in the code below I want bird2 when it reaches frame 3 and spState(1) - this means first row - to switch to spState (2) second row. Code: if ($('#bird2'['current_frame']) == 3 && $('#bird2').spState(1)) { $('#bird2').spState(2); } else { $('#bird2').spState(1); } Here's the code regarding the spState() Code: spState: function(n) { $(this).each(function() { // change state of a sprite, where state is the vertical // position of the background image (e.g. frames row) var yPos = ((n - 1) * $(this).height()) + 'px'; var xPos = $._spritely.getBgX($(this)); var bp = xPos + ' -' + yPos; $(this).css('background-position', bp); }); return this; this is from http://www.spritely.net/ you will notice on this site that if you drag the slider to the left the bird sprites change direction, in fact they play the second row of frames. The reason I want my bird sprite to go automatically to the next row is because I am using video turned into individual frames and a png strip, and I am limited by the max width of png (8192px). see http://www.cranihum.com/ scroll down to see the bird on the rooftop. Each frame in that bird sprite is 80px wide and there are 93 frames. So I would like to include multiple rows to allow me to increase the number of frames. Up to 15 rows will be needed and after the last row it should go back to the first row. Perhaps a switch statement would be better than what I currently have. I am new to JavaScript and have been trying to pick up clues from http://www.w3schools.com I am very happy to learn and I hope to be prompted and pushed in the right direction. I hope my request is clear, please ask questions if not. Thank you Will I'm no javascript expert, in fact i know very little. I Design wordpress themes in photoshop and I'm looking to add a little more "spice" to my themes using jQuery UI so i made a theme with this tabbed horizontal navigation with the sub menu showing horizontally under the menu when you hover over it. So i searched google on how to do this jQuery menu and got this. Code: <script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#main_nav li a.main").hover(function(){ $("#main_nav li a.main").removeClass("active"); $(this).addClass("active"); $(this).queue(function() { $(".sub_nav").fadeOut(); $(this).siblings(".sub_nav").fadeIn(); $(this).dequeue(); }); }); }); </script> The other part Code: <div class="menu"> <ul id="main_nav"> <li><a href="" class="main">ALL</a> <ul class="sub_nav"> <li><a href="">HOME</a></li> <li><a href="">NEWS</a></li> <li><a href="">ARTICLES</a></li> <li><a href="">PREVIEWS</a></li> <li><a href="">REVIEWS</a></li> <li><a href="">MEDIA</a></li> <li><a href="">GAME WIKI</a></li> <li><a href="">FORUMS</a></li> <li><a href="">SUBMIT CONTENT</a></li> <li><a href="">Journalist Pro</a></li> </ul> </li> <li><a href="" class="main">XBOX30</a> <ul class="sub_nav"> <li><a href="">HOME</a></li> <li><a href="">NEWS</a></li> <li><a href="">ARTICLES</a></li> <li><a href="">PREVIEWS</a></li> <li><a href="">REVIEWS</a></li> <li><a href="">MEDIA</a></li> <li><a href="">GAME WIKI</a></li> <li><a href="">FORUMS</a></li> <li><a href="">SUBMIT CONTENT</a></li> <li><a href="">Journalist Pro</a></li> </ul> </li> <li><a href="" class="main">PS3</a> <ul class="sub_nav"> <li><a href="">HOME</a></li> <li><a href="">NEWS</a></li> <li><a href="">ARTICLES</a></li> <li><a href="">PREVIEWS</a></li> <li><a href="">REVIEWS</a></li> <li><a href="">MEDIA</a></li> <li><a href="">GAME WIKI</a></li> <li><a href="">FORUMS</a></li> <li><a href="">SUBMIT CONTENT</a></li> <li><a href="">Journalist Pro</a></li> </ul> </li> <li><a href="" class="main">Wii U</a> <ul class="sub_nav"> <li><a href="">HOME</a></li> <li><a href="">NEWS</a></li> <li><a href="">ARTICLES</a></li> <li><a href="">PREVIEWS</a></li> <li><a href="">REVIEWS</a></li> <li><a href="">MEDIA</a></li> <li><a href="">GAME WIKI</a></li> <li><a href="">FORUMS</a></li> <li><a href="">SUBMIT CONTENT</a></li> <li><a href="">Journalist Pro</a></li> </ul> </li> <li><a href="" class="main">Wii</a> <ul class="sub_nav"> <li><a href="">HOME</a></li> <li><a href="">NEWS</a></li> <li><a href="">ARTICLES</a></li> <li><a href="">PREVIEWS</a></li> <li><a href="">REVIEWS</a></li> <li><a href="">MEDIA</a></li> <li><a href="">GAME WIKI</a></li> <li><a href="">FORUMS</a></li> <li><a href="">SUBMIT CONTENT</a></li> <li><a href="">Journalist Pro</a></li> </ul> </li> <li><a href="" class="main">PC</a> <ul class="sub_nav"> <li><a href="">HOME</a></li> <li><a href="">NEWS</a></li> <li><a href="">ARTICLES</a></li> <li><a href="">PREVIEWS</a></li> <li><a href="">REVIEWS</a></li> <li><a href="">MEDIA</a></li> <li><a href="">GAME WIKI</a></li> <li><a href="">FORUMS</a></li> <li><a href="">SUBMIT CONTENT</a></li> <li><a href="">Journalist Pro</a></li> </ul> </li> <li><a href="" class="main">VITA</a> <ul class="sub_nav"> <li><a href="">HOME</a></li> <li><a href="">NEWS</a></li> <li><a href="">ARTICLES</a></li> <li><a href="">PREVIEWS</a></li> <li><a href="">REVIEWS</a></li> <li><a href="">MEDIA</a></li> <li><a href="">GAME WIKI</a></li> <li><a href="">FORUMS</a></li> <li><a href="">SUBMIT CONTENT</a></li> <li><a href="">Journalist Pro</a></li> </ul> </li> <li><a href="" class="main">PSP</a> <ul class="sub_nav"> <li><a href="">HOME</a></li> <li><a href="">NEWS</a></li> <li><a href="">ARTICLES</a></li> <li><a href="">PREVIEWS</a></li> <li><a href="">REVIEWS</a></li> <li><a href="">MEDIA</a></li> <li><a href="">GAME WIKI</a></li> <li><a href="">FORUMS</a></li> <li><a href="">SUBMIT CONTENT</a></li> <li><a href="">Journalist Pro</a></li> </ul> </li> <li><a href="" class="main">DS</a> <ul class="sub_nav"> <li><a href="">HOME</a></li> <li><a href="">NEWS</a></li> <li><a href="">ARTICLES</a></li> <li><a href="">PREVIEWS</a></li> <li><a href="">REVIEWS</a></li> <li><a href="">MEDIA</a></li> <li><a href="">GAME WIKI</a></li> <li><a href="">FORUMS</a></li> <li><a href="">SUBMIT CONTENT</a></li> <li><a href="">Journalist Pro</a></li> </ul> </li> </ul> </div> </div> </div> I'm needing the first tab (the "ALL" tab) to be selected by default, but i don't have the first clue on how to do this. You can paste the code in notepadd++ and you can see what i mean. I have 3 divs (boxes) next to each other, I can input text via a textarea to each. I need all 3 to resize - be the same size on text overflow - so if box a gets 100 lines of code and resizes, the other 2 should follow. I have written this js, and added it to the button which moves the text to the boxes (to the onclick) Code: // JavaScript Document function adjust() { if (document.getElementById('section1').style.height != 380 + "px") { document.getElementById('section2').style.height === document.getElementById('section1').style.height; document.getElementById('section3').style.height === document.getElementById('section1').style.height; } else if (document.getElementById('section2').style.height != 380 + "px") { document.getElementById('section1').style.height === document.getElementById('section2').style.height; document.getElementById('section3').style.height === document.getElementById('section2').style.height; } else if (document.getElementById('section3').style.height != 380 + "px") { document.getElementById('section1').style.height === document.getElementById('section3').style.height; document.getElementById('section2').style.height === document.getElementById('section3').style.height; } } any ideas what's wrong here? hello all member help me quick i am create a one form in 10 texbox. i am copy other web Url link when i am paste in textbox cursor not move automatically to the second textbox. and when paste the second textbox the cursor move the not third textbox. please help me how can move automatically cursor textbox only past. not mixmim leg using. only using paste. send completely code java script and input code quickly thanks I frequent a site that involves typing huge numbers. And I'm thinking of making a userscript that automatically adds commas as I type numbers on all the input boxes. There are multiple input boxes and it has two types: First input type has similar name ; Second input type has similar class. Here's an example of a page: Code: <input type="text" value="0" name="buy_price"><br/> <input type="text" value="0" name="buy_price"><br/> <input type="text" value="0" name="buy_price"><br/> <br/> <input type="text" value="0" class="money-input"><br/> <input type="text" value="0" class="money-input"><br/> <input type="text" value="0" class="money-input"> My code so far. But it doesn't seem to work. The main function was taken from here. Code: function add_commas(number){ //remove any existing commas... number=number.replace(/,/g, ""); //start putting in new commas... number = '' + number; if (number.length > 3) { var mod = number.length % 3; var output = (mod > 0 ? (number.substring(0,mod)) : ''); for (i=0 ; i < Math.floor(number.length / 3); i++) { if ((mod == 0) && (i == 0)) output += number.substring(mod+ 3 * i, mod + 3 * i + 3); else output+= ',' + number.substring(mod + 3 * i, mod + 3 * i + 3); } return (output); } else return number; } function addattribute() { //adds onkeyup and removes zero of first input type document.getElementsByName("buy_price")[0].setAttribute("onkeyup", "this.value=add_commas(this.value);"); document.getElementsByName("buy_price")[0].removeAttribute('value'); //adds onkeyup and removes zero of second input type document.getElementsByClassName("money-input")[0].setAttribute("onkeyup", "this.value=add_commas(this.value);"); document.getElementsByClassName("money-input")[0].removeAttribute('value'); } window.onload = addattribute; EDIT: I believe the function function add_commas(number) works. But the problem is I need to find a way to add onkeyup="this.value=add_commas(this.value);" to the input boxes mentioned. EDIT #2: Well I guess I'm back to 0.The function function add_commas(number) seems to only work if it's on the actual html file inside <script> tags. But once you separate it and apply it as a userscript, it doesn't seem to function. I am developing a web application based on a Java servlet. The servlet outputs html and javascript codes and receives some result from a thread, which works behind the servlet. Thus, html and javascript codes dynamically varies. While result equals null (a thread is not completed), it shows "Currently processing," and refreshes Code: <div id="load"> - </div> every second automatically. After receiving some results, it should stop automatic refreshing and show "Done." I wrote source codes described below. It shows "Done" after getting some results, but does not stop refreshing. However, when I manually refresh the page (Ctrl-R), the script is loaded and reloading is stopped. How can I pull javascript codes automatically? Code: <head> <script type=\"text/javascript\"> var auto_refresh = setInterval( function start() { $('#load').load('./Page' + ' #load'); }, 1000); </script> </head> <div id="load"> if (result == null) { // the variable result is received from a behind thread every second. // while a thread is processed <p>Currently processing. <p> } else { // a thread is completed // try to stop reloading <script type=\"text/javascript\"> clearInterval(auto_refresh); </script> <p>Done. <p> } </div> |