JavaScript - Timed Button
I need an timed button. When you come to site, you must wait in that site ?? seconds and then button comes pressable.
Similar TutorialsFolks I'm so in the dark about this that I couldn't even think of a sensible title for the thread! One of my colleagues reckons that some years ago she worked on a website that contained images that were set to be visible to users only between certain dates (different dates for different images, so an image representing January would be visible only during January, and so on). Does this sound like something familiar? If so, would it be done using Javascript? Thanks Remster Hi everyone! I'm new to this forum for posting, but i've been reading threads on this site for a few months now.. seems like a decent place to get info... so, hello everyone! My name's Will, (musical moniker on soundcloud / fb etc is StrangeFlow, i make electronic music, funk, hip hop, etc... ) ..I'm 25, I'm in Lansing , Michigan, my hometown (but still have residency in NorCal, where Im trying to get back to in a few months) I have some experience programming but i'm sure not as much as some of the experts on here i dont know if it's bad etiquette to post a question in my first thread but i have a good question that hasn't been able to get resolved, and I figured someone on here might have some good advice.. Does anyone on here use soundcloud? they have a really nifty timed-comments bar, you can check it out on any soundcloud music page... Ive started seeing it on vimeo recently, I think it's something thats starting to catch on. Anyway,, I had an idea for a website, but the thing is, it would require a timed-comments bar. But.. my problem is, since I'm not as much of an expert as some of the people on here, what would it take to program it? I'm learning some C#, and I heard it would be that or php.. but.. I don't know.. any advice on that timed comments thing? Any good points in the right direction would be extremely appreciated! Thanks everyone! I look forward to posting more in the future on this forum, and I'll gladly offer any of my advice on topics I am knowledgable. -StrangeFlow **Solved**
I once bought some plans on the net and was sent a link that said I could open so many times or for 1 week, I cant remember exactly. But now I am doing a web site and need a link like that any ideas. I would prefer it to open only so many times.
First off, i have no idea what to do, because when i get beyond the realm of html/css, vb and php (some) i become lost. I hope someone can help me achieve this because i have no idea what i'm doing, and I've been at it for 2 weeks and no money to hire someone to do this for me. If you ever been in my situation, you know exactly how i feel. I have no code of my own to show you, but hope someone can still help me. I'm have a number 0.0000000, and every min i need that number to increase to 0.0000000, than to 0.0000002 and so on and so forth. Every time i click a button, whatever the number has risen to, it will reset it back down to 0.0000000. Can someone help me out with this? Hello, I am trying to have 4 different images change when the user hits the start button. The speed they change in is based on what selection they have chosen (fast = every second, med = 3 sec, slow = 5 sec), and this cycle repeats until the user has hit the stop button. However, I am struggling to get this to work and have looked around the web for help, but cannot find it. <html> <head> <title>Untitled</title> </head> <body> <img src = "pic1.jpg" id = "swapper"> <form name = "form1"> <input type = "button" value = "Start" onclick = "Swap()"> <input type = "button" value = "Stop" onclick + "Stop()"> Speed: <select name = "Speed"> <option>Slow</option> <option>Medium</option> <option>Fast</option> </select> </form> <script language="JavaScript" type="text/javascript"> var Images = array["pic1.jpg","pic2.jpg","pic3.jpg","pic4.jpg"]; function Swap(){ } function Stop(){ } //clear it: clearInterval(imageSwapInterval); </script> </body> </html> I have not included any attempt of a code for the functions because I have tried at least 8 different things and have failed to get it to properly work each time. Also the array I set up does not work either. Thank you for the help and your time, Crimmm Looks to me like this ought to work, but since I'm here obviously it doesn't. Regarding the HTML in question, there are divs and they do contain child elements. I'm trying to write this in as generic a fashion as possible, without using IDs or other means of targeting elements. And yes, the jQuery library is referenced/linked to the page. Any pointers much appreciated. Thank you <script type="text/javascript"> // <![CDATA[ var x=0; var h=1000; var Divs=document.getElementsByTagName("div"); function fades() { var i=0; var s=0; $("div").fadeOut(1000); while(x<Divs.length) { setInterval('fadeIns()',h); } } function fadeIns() { if(i<100) { Divs[x].childNodes[s].style.opacity=i/100; i++; } else if(s<Divs[x].childNodes.length) { clearInterval(h); s++; i =0; setInterval('fadeIns()',h); } else { clearInterval(h); x++; fades(); } } window.onload=fades; // ]]> </script> Hello, I am trying to create an image carousel for the website found here. As you can see everything works fine, however, I would like it to automatically scroll through the images every X seconds. I did not write this script (the credits are still in tact) and I know very very little about writing javascript, so I am hoping someone here can help. Thank you in advance for any replies and any suggestions/tips to making it a better script. The .js file: Code: /** * @author Bruno Bornsztein <bruno@missingmethod.com> * @copyright 2007 Curbly LLC * @package Glider * @license MIT * @url http://www.missingmethod.com/projects/glider/ * @version 0.0.3 * @dependencies prototype.js 1.5.1+, effects.js */ /* Thanks to Andrew Dupont for refactoring help and code cleanup - http://andrewdupont.net/ */ Glider = Class.create(); Object.extend(Object.extend(Glider.prototype, Abstract.prototype), { initialize: function(wrapper, options){ this.scrolling = false; this.wrapper = $(wrapper); this.scroller = this.wrapper.down('div.scroller'); this.sections = this.wrapper.getElementsBySelector('div.section'); this.options = Object.extend({ duration: 1.0, frequency: 3 }, options || {}); this.sections.each( function(section, index) { section._index = index; }); this.events = { click: this.click.bind(this) }; this.addObservers(); if(this.options.initialSection) this.moveTo(this.options.initialSection, this.scroller, { duration:this.options.duration }); // initialSection should be the id of the section you want to show up on load if(this.options.autoGlide) this.start(); }, addObservers: function() { var controls = this.wrapper.getElementsBySelector('div.controls a'); controls.invoke('observe', 'click', this.events.click); }, click: function(event) { this.stop(); var element = Event.findElement(event, 'a'); if (this.scrolling) this.scrolling.cancel(); this.moveTo(element.href.split("#")[1], this.scroller, { duration:this.options.duration }); Event.stop(event); }, moveTo: function(element, container, options){ this.current = $(element); Position.prepare(); var containerOffset = Position.cumulativeOffset(container), elementOffset = Position.cumulativeOffset($(element)); this.scrolling = new Effect.SmoothScroll(container, {duration:options.duration, x:(elementOffset[0]-containerOffset[0]), y:(elementOffset[1]-containerOffset[1])}); return false; }, next: function(){ if (this.current) { var currentIndex = this.current._index; var nextIndex = (this.sections.length - 1 == currentIndex) ? 0 : currentIndex + 1; } else var nextIndex = 1; this.moveTo(this.sections[nextIndex], this.scroller, { duration: this.options.duration }); }, previous: function(){ if (this.current) { var currentIndex = this.current._index; var prevIndex = (currentIndex == 0) ? this.sections.length - 1 : currentIndex - 1; } else var prevIndex = this.sections.length - 1; this.moveTo(this.sections[prevIndex], this.scroller, { duration: this.options.duration }); }, stop: function() { clearTimeout(this.timer); }, start: function() { this.periodicallyUpdate(); }, periodicallyUpdate: function() { if (this.timer != null) { clearTimeout(this.timer); this.next(); } this.timer = setTimeout(this.periodicallyUpdate.bind(this), this.options.frequency*1000); } }); Effect.SmoothScroll = Class.create(); Object.extend(Object.extend(Effect.SmoothScroll.prototype, Effect.Base.prototype), { initialize: function(element) { this.element = $(element); var options = Object.extend({ x: 0, y: 0, mode: 'absolute' } , arguments[1] || {} ); this.start(options); }, setup: function() { if (this.options.continuous && !this.element._ext ) { this.element.cleanWhitespace(); this.element._ext=true; this.element.appendChild(this.element.firstChild); } this.originalLeft=this.element.scrollLeft; this.originalTop=this.element.scrollTop; if(this.options.mode == 'absolute') { this.options.x -= this.originalLeft; this.options.y -= this.originalTop; } }, update: function(position) { this.element.scrollLeft = this.options.x * position + this.originalLeft; this.element.scrollTop = this.options.y * position + this.originalTop; } }); The HTML where inserted onto the page Code: <script type="text/javascript" charset="utf-8">var my_glider = new Glider('my-glider', {duration:0.5});</script> Hi, I've ben trying to figure this one out for days now and so I'd thought to give it a shoot here to see whether anybody can give me any advice or inspiration. Basically what I am trying to do is command a click of a bottom for a certain set time. for example: On the google main search engine page. Once ive typed in a search for "skateboards". I would then like to command the "search" bottom to clicked at 10 pm at night thus executing the search for "skateboards" going into the next page with all the search results. I was wondering if it would be possible to right a Java command that could be run in the Mozilla Fire Fox Scratch pad tool. ( Which is found under Tools --> Web Developer.) Please let me know of anything. It would be very grateful. Thanks, Jon57 Can someone tell me why this short script won't work? <script type="text/JavaScript"> <!-- function timedRefresh(timeoutPeriod) { var number = rand(7); if (number == 1) { var bgcss = "theme1.css"; } else if (number == 2) { var bgcss = "theme2.css"; } else if (number == 3) { var bgcss = "theme3.css"; } else if (number == 4) { var bgcss = "theme4.css"; } else if (number == 5) { var bgcss = "theme5.css"; } else if (number == 6) { var bgcss = "theme6.css"; } else if (number == 7) { var bgcss = "theme7.css"; } document.write('<link href="bgcss "'+ 'type=text/css rel=stylesheet>'); } // --> </script> </head> <body onload="JavaScript:timedRefresh(10000);"> Knowing just enough about javascript to get myself in trouble, I have put three timed javascripts to appear from 18 December to the 1 January on three pages of my sister's website. The scripts are on the main index for the site; the index page for the bibliography folder /bibliography/ and in the education folder on just one page: /education/educationlinks.html. Part one of the script inserts the css file; part two of the script inserts a "snowing" script and part three inserts a "make it stop snowing/let it snow" script. Everything is working perfectly for the main index page and the bibliography page. But I cannot figure out why the 3rd "make it stop snowing/let it snow" refuses to show up on the page in the education folder (the snowing javascript IS working on all three pages). There are no errors being thrown and the education page validates. This is the coding for the 3rd script: Code: // snowscript part 3: Show the script between 19-31 Dec and 1 Jan var date = new Date(); var d = date.getDate(); var m = date.getMonth() + 1; dm = d + m; if (m = 12) { if (d > 18) { document.write('<script src="/scripts/snowlinkswitch.js" type="text/javascript" id="snow"></script>'); } else { document.write(''); } } else if (dm == 1,1) { document.write('<script src="/scripts/snowlinkswitch.js" type="text/javascript"></script>'); } else { document.write(''); } This is the coding for snowlinkswitch.js Code: function myhref(){ document.getElementById('myAnchor').innerHTML="please let it snow!"; document.getElementById('myAnchor').href=location.href; document.getElementById('myAnchor').title="let it snow! let it snow!"; document.getElementById('myAnchor').onclick="location.reload(); startstop('spanstyle'); return false;"; } // document.write ('<div id="snowlinks"><img src="/images/snow3aa.gif" width="11" height="11" border="0" alt="*"> <a id="myAnchor" href="" onclick="myhref();hidesnow(); return false;" title="please make it stop snowing!">please make it stop snowing!<\/a> <img src="/images/snow3aa.gif" width="11" height="11" border="0" alt="*"></div> '); I would search for a similar occurrence but have no clue about what search words to use. Does anyone here have an idea about what I have done incorrectly that is causing this to happen? Many thanks. E Morris Toronto, Canada Hi, im fairly new at all this, so please forgive me if I have misunderstood the guidelines on posting threads for this topic. Im needing some help with adding a timed delay for a widget I have on my website. My website is hosted on moonfruit, a flash based web builder, its very beginners level, and so this makes me feel like the new kid at school posting on this forum. however moonfruit does have a HTML/JavaScript snippet Which allows me to paste in code and show the cooliris gallery But is has become crucial to my websites completion that this widget must have a timed delay on it ive been at google for days till the point where im seeing the same pages again, and have come across setTimeout, unfortunately that's as far as I can seem to go, ive tried pasting in the code in numerous places and I just cant get it to work, i have pasted in other JavaScript codes, and they have worked, so i am convinced that its just me being a noob, other than it being a limitation on moonfruit I would appreciate any help with this Here is the code that im trying to get a delayed time of 10 seconds or so. [CODE] <object id="o" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="845" height="350"><param name="movie" value="http://apps.cooliris.com/embed/cooliris.swf"/><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always"/><param name="flashvars" value="style=dark&backgroundColor=#0d0d0d&feed=api://www.flickr.com/?user=41683862@N04%26album=72157622009594203&glowColor=#FFFFFF&showSearch=false&showEmbed=false&show Tutorial=true&showChrome=true"/><embed type="application/x-shockwave-flash" src="http://apps.cooliris.com/embed/cooliris.swf" flashvars="style=dark&backgroundColor=#0d0d0d&feed=api://www.flickr.com/?user=41683862@N04%26album=72157622009594203&glowColor=#FFFFFF&showSearch=false&showEmbed=false&show Tutorial=true&showChrome=true" width="845" height="350" allowFullScreen="true" allowScriptAccess="always"></embed></object> [CODE] Again any help is most appreciated Hi Guys, I'm embarking on a new project - although I've hit a wall. I require a page to refresh at a scheduled date and time, several times a day. For example, I would like the web page to reload the index at 3:15PM So if anyone has the web page open during that time, it will automatically refresh for them. Timing is quite important so I would need the script to use the server (hosts) time and not the end users time. I am currently deciding on which server language to use, although Javascript is probably a suitable option? or would ajax be more the thing for this? The webpage must execute the refresh at the time 3:15pm, so no matter when someone visits the page, even if its hours before, it must refresh at that time. If anyone has any pointers on the best way to achieve this and what language to start with I am forever greatful I do a lot of image design work and although I have worked with a few coders in the past but I haven't gone too much into coding myself, but its something I'm going to take time to learn and get involved in, so I'm not looking for script hand outs here, mainly just a nudge in the right direction. Thank you guys!! I want to be able to display the whole contents of a text file containing 4 paragraphs of text, on a static web page, as soon as a video finishes playing on the page. The video is to be set to autorun as soon as the page loads in the browser. The text file mentioned above, is to remain hidden when the page initially loads and the video is playing. Please I need your advice about what JavaScript code to use to achieve this effect, and where to place the code in the HTML code of the web page. I am new to website design and the use of JavaScript code. I have seen examples of code used for the timed delay of the display of an image file, after a video has finished playing. I do not know how to apply this to the display of a text file. I do not want to convert the whole text file into an image file, as I feel this would negatively affect the search engine optimisation of the page, if there is no text content on the page. Thank you. Hey guys. This is vague because I dont know what exactly to tell you but please reply with me so I can fix this. I want to add something to my forum. Specifically, I want to add a HTML and Picture button for when you go to reply. Like posting an article here, there are also these options (font, alignment, insert image) I do not know how to achieve this but shouldnt be too hard. Here are the two sources you will need to look through to help me fix the forum. http://neoweather.com/FWFORUM.JS http://static.websimages.com/JS/fw.js THANKS Hey guys. I want to add something to my forum. Specifically, I want to add a HTML and Picture button for when you go to reply. Like posting an article here, there are also these options (font, alignment, insert image) I do not know how to achieve this but shouldnt be too hard. Here are the two sources you will need to look through to help me fix the forum. http://neoweather.com/FWFORUM.JS http://static.websimages.com/JS/fw.js THANKS Hi, I am not entirely sure what I am doing wrong here, and I have been looking at this for ages, so apologies in advance if I have become so bleary eyed I can't see something simple. I use php to create buttons based on values pulled for a table. The problem I have is when you click on the first button the javascript function works great, when you click on the next button you get the same output even though it should be different results. I am working in ff and I can see on my firebug console that the javascript function is being called, but it is not passing the new value of the second or third button, it just keeps repassing the value of the first button. So not entirely sure where I am going wrong here. My page is: Code: <script type="text/javascript"> function loadXMLDoc2(File,ID,Msg){ if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { try{ xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } } xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState==4 && xmlhttp.status==200){ document.getElementById(ID).innerHTML=xmlhttp.responseText; } } var params=Msg; xmlhttp.open("POST",File,true); xmlhttp.setRequestHeader("Pragma", "Cache-Control:no-cache"); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.setRequestHeader("Content-length", params.length); xmlhttp.setRequestHeader("Connection", "close"); xmlhttp.send(params); } </script> <head> <body> <?php $con = mysql_connect("localhost","user","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("mydb", $con); $result = mysql_query("SELECT DISTINCT theme FROM goods WHERE category='{$_POST['category']}' ORDER BY theme DESC"); while($row = mysql_fetch_array($result)){ echo '<input type="text" class="hidden" name="theme" id="theme" value="' . $row['theme'] . '" ><input type="button" class="button3" name="product" id="product" value="' . $row['product'] . '" onClick="loadXMLDoc2(\'getShow.php\',\'txtHint\',\'theme=\'+encodeURI(document.getElementById(\'rtheme\').value))" > '; } echo '<br /><br /> <div id="txtHint"><div> <br /> <br />'; mysql_close($con); ?> And getShow.php produces a table with a list of product images, names and prices, based on theme. So basically not sure where I am going wrong here? i'm still a relative noob and this has me stuck - i have a save button with a "save as copy" in the save dropdown list. add new item directs to a premade/formatted project that is used as a template, so on that item i only want/need the "save as copy" but on all other items that use the form i need to only have the "save" function. is there any way to either change the function of the button depending on item that is being viewed in the edit screen OR hide the "save" button and only show the button associated with "save as copy - and vis versa for the rest of the items?? current button code is - protected function getToolbar() { $options = array(); $user = JFactory::getUser(); $create_ms = $user->authorise('core.create', 'com_pfmilestones'); $create_task = $user->authorise('core.create', 'com_pftasks'); $options[] = array( 'text' => 'JSAVE', 'task' => $this->getName() . '.save'); $options[] = array( 'text' => 'Save as new project', 'task' => $this->getName() . '.save2copy', 'options' => array('access' => ($this->item->id > 0))); PFToolbar::dropdownButton($options, array('icon' => 'icon-white icon-ok')); item used as template is id=8 any help or suggestions would be greatly appreciated.. i got javascripts button : Code: <input type="button" value="select" onClick="document.getElementById('input').select()" /> how can i transform "button" to image button (gif) I have 4 rows in a table. Each row consist of 4 radio buttons. Each radio button per row has different values in it but has the same name (group) ex: <input type="radio" name="a" value="1"> <input type="radio" name="a" value="2"> <input type="radio" name="a" value="3"> <input type="radio" name="a" value="4"> <input type="radio" name="b" value="1"> <input type="radio" name="b" value="2"> <input type="radio" name="b" value="3"> <input type="radio" name="b" value="4"> and so on.. If I click radio button A with value 2, I want to output the total at the bottom as "2".. Also, if I click radio button B with value 3, I want to output the total of A and B as 5 and so on.. How can I automatically calculate the answer based on which radio button was click? update: I got my answer from this site: http://stackoverflow.com/questions/1...s-using-jquery |