problem with document.getElementById

Discussion in 'JavaScript' started by judge0, Oct 7, 2008.

  1. #1
    i want to add document.getElementById with this script
    <html>
    <head>
     
    <script src="date.format.js"></script>
    <script>
    function nextDateFromDateString(text) {
        var regex = /(\d+)\/(\d+)\/(\d+)(.*)/;
        var date = new Date(text.replace(regex, '$2/$1/$3$4'));
        date = new Date(date.valueOf() + 86400000);
        return date.format("mm/dd/yy HH:MM:ss");
    }
    var date = "29/06/2008 09:00:00";
    date = nextDateFromDateString(date);
    </script>
    </head>
    <body><table>
    <tr>
    <td id="judge">29/06/2008 09:00:00</td>
    <td>..</td>
    <td>..</td>
    <td>..</td>
    </tr>
    </table></body>
    </html>
    Code (markup):
    here's the external file source code
     
    judge0, Oct 7, 2008 IP
  2. xlcho

    xlcho Guest

    Messages:
    532
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Add it where? To do what? Try being more specific. It's like you go to the car dealer and say 'I want a car' :D
     
    xlcho, Oct 7, 2008 IP
  3. dpsubi1

    dpsubi1 Notable Member

    Messages:
    9,318
    Likes Received:
    420
    Best Answers:
    0
    Trophy Points:
    280
    #3
    please explain what you are trying to accomplish ?
     
    dpsubi1, Oct 7, 2008 IP
  4. judge0

    judge0 Peon

    Messages:
    400
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #4
    the main goal:i want to add +1 to day mean the day appear as 30 rather than 29
    and i try to used this code to solve my problem

    problem : i want to use document.getElementById i but i didn't know.
    mean that i want to add this in first <td> which have id=judge to add 1+ for any day appear in this cell

    if u have any idea beyond the scope this script plz share
     
    judge0, Oct 7, 2008 IP
  5. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #5
    yeah adding + 1 day w/o a proper calendar function is not a good plan. how would you know if its 28,29,30 or 31 days before you turn over into month+1?

    there are plenty of js calendar scripts and classes around that can do this, just google. sometimes, it does not pay off to invent the wheel imo.
     
    dimitar christoff, Oct 7, 2008 IP
  6. judge0

    judge0 Peon

    Messages:
    400
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #6
    let me explain this data express oneself about start contract data to my client , when i insert the date in my databse stored -1 mean if creat contract in 28 will stored 27 in database and so on ....... i want script make the data as it were mean retraive the contract data to 28
     
    judge0, Oct 7, 2008 IP
  7. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #7
    so, then - change your mysql statement to something like:

    set contract_date = DATE_ADD(NOW(), INTERVAL -1 DAY)

    problem solved, you don't need to trust js and client machines and so forth.
     
    dimitar christoff, Oct 7, 2008 IP
  8. judge0

    judge0 Peon

    Messages:
    400
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #8
    wow it can
    what about if i use MS dynamic CRM database which use MSSQL
     
    judge0, Oct 7, 2008 IP