By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,456 Members | 1,270 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,456 IT Pros & Developers. It's quick & easy.

ASP and JavaScript problem

P: n/a
Hello all!

I have problem with code. Firstly I have created the VBScript code which
count me the time and days which left to the end of working week. I work
from 8:00 am till 4 pm.
I would like to show this information on the screen by using "input form
element" and using onload event which is refreshed after every 1 second.
Unfortunately I don`t want
to replace vbscript code on javascript code to do so. I want to have
vbscirpt. Could you do me a favour and rebuild this code below to make it
properly working.

I would be very grateful if you could help me
Regards
and thanx for help
Marcin from Poland
----------------------------------------------------------------------------
-----------------------

<HTML>
<HEAD>

<% @language=vbscript %>
<%
function funkcja_czas()
dim roznica_koniec_dnia_pracy,roznica_koniec_tygodnia, roznica_czas_m,
roznica_czas_h, roznica_czas_s, znacznik_dnia1,znacznik_dnia2,
znacznik_dnia, czas

roznica_koniec_tygodnia=(7-weekday(date,vbMonday))

roznica_koniec_dnia_pracy=roznica_koniec_tygodnia-2
roznica_czas_h=(DateDiff("h",Time,CDate("16:00:00" ))-1)

if Hour(Time)<16 then
czas=Cdate(Cstr(Hour((Time+Cdate("01:00:00")))) & ":00:00")
roznica_czas_m=(DateDiff("n",time,czas))
czas=Cdate(Cstr(Hour(Time) & ":" & Minute(Time+Cdate("00:01:00")) & ":00"))
roznica_czas_s=(DateDiff("s",time,czas))
if roznica_czas_s=60 then
roznica_czas_s=0
end if
else
roznica_czas_m=0
end if
if roznica_koniec_dnia_pracy=1 then
znacznik_dnia1="dzień"
else
znacznik_dnia1="dni"
end if

if roznica_koniec_tygodnia=2 then
znacznik_dnia2="dzień"
else
znacznik_dnia2="dni"
end if

funkcja_czas= ("Koniec tygodnia nastapi za " & roznica_koniec_tygodnia & " "
& znacznik_dnia2 & "<BR>" & "Koniec tygodnia pracy nastapi za " &
roznica_koniec_dnia_pracy &" "& znacznik_dnia1 & " " & roznica_czas_h & ":"
& roznica_czas_m & ":" & roznica_czas_s & " sec.")
end function
ff="1"
%>

<SCRIPT LANGUAGE="JavaScript">
<!--

function clock()
{

document.clock.time.value=
<%
ff
%>;
window.setTimeout("clock()", 900);
}

// -->
</SCRIPT>

</HEAD>

<BODY onload="clock();">

<form name="clock">
Time <input type=text name="time" size="20" style="border: 0">
</form>

Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.