Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Old 05-21-2006, 03:47 AM Counter
lizard dude's Avatar
Super Talker

Posts: 119
Location: France
Trades: 0
Hi i would to make a counter that will increase by one every time someone goes on my page

Now here is my code:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>counter</title>
</head>
<script language="JavaScript" type="text/javascript">
var number=0
function add()
{
number++;
document.f.counter.value=number;
}


</script>

<body onload="add()">
<form name="f">
	<input type="text" name="counter" value="">
</form>



</body>
</html>
But the value will alway be 1, even if i reload. Is there anyway to make the var number keep the new number?
__________________
forum------->
Please login or register to view this content. Registration is FREE
, for people who wants to have a good time ;)
website------>
Please login or register to view this content. Registration is FREE
(might be in construction :D)
Hope you have a great time and that my post is helpfull ;)
lizard dude is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-21-2006, 05:20 AM Re: Counter
Novice Talker

Posts: 13
Location: Vancouver, BC
Trades: 0
it won't work, because this counting number is only remembered by the very browser of the site visitor for that webpage. when the browser is closed or if another page is loaded into it, the number is immediately forgotten. so the visitor will ALWAYS see "1" as the count.

doing a hit counter requires the web server to record the count. (javascript runs on browser, not server). you can use a hitcount plugin:

http://www.statcounter.com/
__________________
Visit my startup - Tooldle.com:
Please login or register to view this content. Registration is FREE
gumlor is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Counter
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.29362 seconds with 12 queries