SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: Date Automation

  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2003
    Location
    Indonesia
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Date Automation

    hi i have a problem with age Updating, when i click the calendar the age textbox will autofill point to current date and it's working properly, but the problem when i test to change the Year on the System/Control Panel on my computer, the age not change automatically....i wondering how could it be......anyone can help...thxx
    here's my code for calendar and age :

    <script LANGUAGE="vbSCript">
    sub window_onload()
    end sub

    Sub GetDate(objMe,x,y)
    strThisElement = objMe.getattribute("IndexVal")
    x= x & "px"
    retVal = window.showModalDialog ("../../Calendar2/calDraw1.asp?Locale=Set""0","0","dialogWidth:248px;dialogHeight:208px;dialogleft:"& x &";dialogtop:"& y &";status: no;unadorned: yes;help: no;scroll:no")

    If retVal <> "" Then
    document.all(strThisElement).value = retVal
    dateofbirth = document.frmQuery.DateOfBirth.value
    age = round(datediff("m",dateofbirth,now)/12)
    if datepart("m",dateofbirth) > datepart("m",now) then
    document.frmQuery.Age.value = age - 1
    else
    document.frmQuery.Age.value = age
    end if
    End If
    End Sub

    </script>

  2. #2
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is client-side VBScript, not server-side. Although it's not actually JavaScript, it's more likely to get an answer in that forum, since they both do exactly the same thing in the browser, using the same DOM/objects, just with a different syntax...

    (I've issued a move request)
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!

  3. #3
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by endrue
    but the problem when i test to change the Year on the System/Control Panel on my computer, the age not change automatically.
    So the age stays the same even once you've reloaded the page?
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!

  4. #4
    SitePoint Enthusiast
    Join Date
    Sep 2003
    Location
    Indonesia
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, marco....that's what i want it...but how..anyway

  5. #5
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by endrue
    Yes, marco....that's what i want it...but how..anyway
    Now I'm even more confused!!

    You *want* the age to stay the same no matter what year your PC clock says? I thought that was the *problem*, and that you want it to *change* as one would expect!!

    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!

  6. #6
    SitePoint Enthusiast
    Join Date
    Sep 2003
    Location
    Indonesia
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry2, ok . I clear the problem i have. The Problem is, the Age Won't Change although i change the date time on the control panel. Then i Want it change automatically when maybe the user date time on the computer is not set for the current date...is that clear.... thx.....sorry make you confused....


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •