javascript help !!

This is a discussion on "javascript help !!" within the JavaScript Forum section. This forum, and the thread "javascript help !! are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jul 20th, 2006, 06:56
New Member
Join Date: Jul 2006
Location: Singapore
Age: 21
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
javascript help !!

right now i have these 2 text fields...
Code: Select all
<%if v_cnt mod 2 = 0 then%>
<td align="center"><INPUT type="text" name=txtClockTime maxlength=5 size=5 value="<%=formatdatetime(v_HistTime,4)%>" style="font-family : Tahoma, Sans-Serif, Verdana, Geneva, Arial, Helvetica; background:#F2F5FE; font-size : 8pt; color: #31345C"></td>
<td width="11"><img src="/images/control/eTimeClock/div.gif"></td>
<%else%>
<td align="center"><INPUT type="text" name=txtClockTime maxlength=5 size=5 value="<%=formatdatetime(v_HistTime,4)%>" style="font-family : Tahoma, Sans-Serif, Verdana, Geneva, Arial, Helvetica; background:#F2F5FE; font-size : 8pt; color: #31345C"></td>
<td width="11"><img src="/images/control/eTimeClock/div.gif"></td>
<%end if%>
and i have this function to check for it...
Code: Select all
function ValidateTime(){
// Checks if time is in HH:MM format.
//Clock-in time 
var i = 0 
timeStr = document.Report.txtClockTime(0).value;
var timePat = /^(\d{1,2}):(\d{2})?$/;
var matchArray = timeStr.match(timePat);
if (matchArray == null) {
alert("Clock-In time must be in a valid format(HH:MM).");
return false;
}
hour = matchArray[1];
minute = matchArray[2];
if (hour < 0  || hour > 23) {
alert("Clock-In hour must be between 0 and 23.");
return false;
}
if (minute<0 || minute > 59) {
alert ("Clock-In minute must be between 0 and 59.");
return false;
}
    
//Clock-Out time 
i = 1
timeStr = document.Report.txtClockTime(1).value;
 
var timePat = /^(\d{1,2}):(\d{2})?$/;
var matchArray = timeStr.match(timePat);
if (matchArray == null) {
alert("Clock-Out time must be in a valid format(HH:MM).");
return false;
}
hour = matchArray[1];
minute = matchArray[2];
if (hour < 0  || hour > 23) {
alert("Clock-Out hour must be between 0 and 23.");
return false;
}
if (minute<0 || minute > 59) {
alert ("Clock-Out minute must be between 0 and 59.");
return false;
}
 
                var sClockin  = document.Report.txtClockTime(0).value
                var sClockout  = document.Report.txtClockTime(1).value
  
 sClockin = sClockin.replace(/:/gi,"");
 sClockout = sClockout.replace(/:/gi,"");
  
 if (parseInt(sClockout) < parseInt(sClockin))
 {
  //alert(parseInt(sClockout));
  //alert(parseInt(sClockin));
  alert ("Clock-Out time must be greater than or equal to Clock-In time");
  return false;
 }
}
it's actually some kind of clocking system that allows people to clock in and out to keep track of their working hours and stuff... right now it only checks for 1st set of clock in and out... i wanna change it such that it checks for more than the 2 entries in cases where there are multiple entries and i dont know how... desperate for help =(
Reply With Quote

Reply

Tags
javascript, help

Thread Tools

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
php and javascript yvettesio JavaScript Forum 8 Mar 14th, 2007 23:18
JavaScript cbrams9 JavaScript Forum 1 Sep 20th, 2006 17:35
using xml in javascript shailu JavaScript Forum 0 Jul 25th, 2006 07:36
Can someone help me with this javascript Galaxyblue JavaScript Forum 2 Mar 11th, 2004 12:18
what does \\ mean in javascript jenjen1018 JavaScript Forum 5 Jan 6th, 2004 17:05


All times are GMT. The time now is 04:47.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43