View Full Version : Need "image" web counter

07-03-2007, 01:58 PM
Hi, I have some problems. I need new web counter for my site. I've put one script to my site (for clock). It displays images instead of strings. So, if it is 12:25pm, it seems like that:http://www.freewebs.com/elektronika91/c1.gifhttp://www.freewebs.com/elektronika91/c2.gifhttp://www.freewebs.com/elektronika91/colon.gifhttp://www.freewebs.com/elektronika91/c2.gifhttp://www.freewebs.com/elektronika91/c5.gifhttp://www.freewebs.com/elektronika91/cpm.gif

This is that script (for clock):
var imageclock=new Object()
//Enter path to clock digit images here, in order of 0-9, then "am/pm", then colon image:
imageclock.digits=["c0.gif", "c1.gif", "c2.gif", "c3.gif", "c4.gif", "c5.gif", "c6.gif", "c7.gif", "c8.gif", "c9.gif", "cam.gif", "cpm.gif", "colon.gif"] imageclock.instances=0
var preloadimages=[]
for (var i=0; i<imageclock.digits.length; i++){ //preload images
preloadimages[i]=new Image()

imageclock.imageHTML=function(timestring){ //return timestring (ie: 1:56:38) into string of images instead
var sections=timestring.split(":")
if (sections[0]=="0") //If hour field is 0 (aka 12 AM)
else if (sections[0]>=13)
for (var i=0; i<sections.length; i++){
if (sections[i].length==1)
sections[i]='<img src="'+imageclock.digits[0]+'" />'+'<img src="'+imageclock.digits[parseInt(sections[i])]+'" />'
sections[i]='<img src="'+imageclock.digits[parseInt(sections[i].charAt(0))]+'" />'+'<img src="'+imageclock.digits[parseInt(sections[i].charAt(1))]+'" />'
return sections[0]+'<img src="'+imageclock.digits[12]+'" />'+sections[1]+'<img src="'+imageclock.digits[12]+'" />'+sections[2]

var clockinstance=this
document.write('<span id="'+this.spanid+'"></span>')
setInterval(function(){clockinstance.update()}, 1000)

var dateobj=new Date()
var currenttime=dateobj.getHours()+":"+dateobj.getMinutes()+":"+dateobj.getSeconds() //create time string
var currenttimeHTML=imageclock.imageHTML(currenttime)+'<img src="'+((dateobj.getHours()>=12)? imageclock.digits[11] : imageclock.digits[10])+'" />'

Can someone write how to use this for making "image" web counter. So, how to use var. image in web counter.

07-03-2007, 11:04 PM
Can someone write how to use this for making "image" web counter. So, how to use var. image in web counter.
It's probably not as simple as just exchanging the numbers.

Your clock is implemented with JavaScript while your counter probably relies on server-side scripting. You will probably need to edit the counter-script in order to get what you want.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum