473,320 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Hit counter

4
hey i got a javascript problem. im trying to creat a javascript code that will count how many times a button input is clicked by a alert box. otherwards everytime someone clicks the button is says "there has been 'X' amount downloads...." in a alert popup. the problem is i aint very good with javascript and looking farther into javascript so far hasent helped with it. this is the code so far.
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. var one="has been a total of"
  3. var two="downloads on this item"
  4. var number="0"
  5. var add="1"
  6. function count() {
  7.     if(id="downloadone") {
  8.     number+add;
  9.     Alert("There + one + add + two")
  10.     window.open("DownloadLink", "window name");
  11.     }
  12.     }
  13. </script>
  14. <form>
  15.   <input type="button" value="Download" id="downloadone" onClick="count();">
  16. </form>
right know all it should do is have a popup that says
There has been a total of 1 downloads on this item
no matter how many people click the download button.
thats if that if condition works at all "if(id="downloadone")"

anyway overall i need help on how i can make a hit counter out of this. obvisoulty no cookies that doesent work very good it will just count for each seperate computer alone. not total downloads.
Aug 5 '07 #1
5 2345
Nojtb
4
is this site really this empty O.o??
Aug 5 '07 #2
Nojtb
4
nvm close better to delete this thread. gotta learn php next :P <_<
Aug 5 '07 #3
acoder
16,027 Expert Mod 8TB
anyway overall i need help on how i can make a hit counter out of this. obvisoulty no cookies that doesent work very good it will just count for each seperate computer alone. not total downloads.
For that, you will need something server-side. Javascript won't help here.
Aug 5 '07 #4
acoder
16,027 Expert Mod 8TB
is this site really this empty O.o??
3 hours on a Sunday (well, it was Sunday here) - that doesn't make it an empty site!
Aug 5 '07 #5
pbmods
5,821 Expert 4TB
Heya, Nojtb.

Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.

Instead of this:
Expand|Select|Wrap|Line Numbers
  1. Alert("There + one + add + two")
You might want to do this:
Expand|Select|Wrap|Line Numbers
  1. alert('There ' + one + ' ' + add + ' ' + two);
  2.  
Aug 5 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Shane | last post by:
:) I am following a tutorial for php (hudzilla.org) absolutely loving it however I am having trouble with the counter example <?php // your content here... $filename = 'counter.txt'; // our...
16
by: Paul Rubin | last post by:
I'd like to have a function (or other callable object) that returns 0, 1, 2, etc. on repeated calls. That is: print f() # prints 0 print f() # prints 1 print f() # prints 2 # etc. ...
7
by: JellyON | last post by:
Hi. Is there a way to delay a call to a page counter (ie. call to a server script from an IMG tag) for the purpose to not lock the page loading awaiting counter be displayed. Maybe a...
0
by: Earl Anderson | last post by:
KB Article Q140908 provided the following function to create an Auto Incrementing Counter: Function Next_Custom_Counter () On Error GoTo Next_Custom_Counter_Err Dim MyDB As Database Dim...
7
by: mistral | last post by:
I use htaccess to protect directory and granting access to download file only for the authorized users. Just want implement simple PHP file download counter for single file. I need track the number...
0
by: Trevor L. | last post by:
I decide to put a custom Hit Counter on my page (below). Then I won't be reliant on the standard FrontPage one which uses webbots. It is called by <b>Hit Counter: </b><!--#include...
12
by: devospice | last post by:
Hi, I'm trying to create a download counter for individual files on a web site and I'm not sure how to do this. Right now I'm using Webalizer to just read the log files and see how many times...
5
by: jasonchan | last post by:
How would you set up a counter in javascript that goes from 5 to 0 This is what i have so far and it is not displaying in the div container "counter" for some reason... <!DOCTYPE html PUBLIC...
3
blackstormdragon
by: blackstormdragon | last post by:
Here were our instructions: "My mother always took a little red counter to the grocery store. The counter was used to keep tally of the amount of money she would have spent so far on that visit to...
2
by: gumbercules | last post by:
I am designing a site that is regulary updated with new podcasts. I would like to be able to have a counter next to each podcast showing how many hits/listens/plays/views each particular podcast has...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.