Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
onclick trenutno vrijeme i datum
Author Message
Son Goku Offline
Novi korisnik
*

Posts: 41
Joined: Jan 2008
Reputation: 0
Post: #1
onclick trenutno vrijeme i datum
Pozdrav. Imam ovu formu i hocu da kad kliknem na svaki checkbox da mi se upise trenutno vrijeme i datum klika, jer kad kliknem na prvi checkbox upise se ok vrijeme, a kad kliknem da druga dva checkboxa upise se vrijeme iz prvog checkboxa. Da li netko zna kako to rijesiti? Hvala :)

Code:
<html>
<head>
<title>Datum / Vrijeme</title>

<script type="text/javascript">
var TheDate = new Date();
var TheDate1 = new Date();
var TheDate2 = new Date();
</script>

</head>

<body>
<form id="forma" name="forma" action="xxx.php" method="post">
<table border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td><input type="checkbox" name="checkbox" value="checkbox" onClick="this.form.datum_vrijeme.value= TheDate.toLocaleString()"/></td>
    <td><input type='text' name='datum_vrijeme' value='{$datum_vrijeme}' readonly/>    </td>
    </tr>
    <tr>
    <td><input type="checkbox" name="checkbox1" value="checkbox" onClick="this.form.datum_vrijeme1.value= TheDate1.toLocaleString()"/></td>
    <td><input type='text' name='datum_vrijeme1' value='{$datum_vrijeme1}' readonly/>    </td>
    </tr>
    <tr>
    <td><input type="checkbox" name="checkbox2" value="checkbox" onClick="this.form.datum_vrijeme2.value= TheDate2.toLocaleString()"/></td>
    <td ><input type='text' name='datum_vrijeme2' value='{$datum_vrijeme2}' readonly/>    </td>
    </tr>
</table>
</form>

</body>
</html>
06-06-2008 02:19 PM
Find all posts by this user Quote this message in a reply
Puž Offline
Redoviti posjetitelj
**

Posts: 132
Joined: Mar 2007
Reputation: 25
Post: #2
RE: onclick trenutno vrijeme i datum
Code:
    <html>
<head>
<title>Datum / Vrijeme</title>

<script type="text/javascript">
var TheDate = new Date();

</script>

</head>

<body>
<form id="forma" name="forma" action="xxx.php" method="post">
<table border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td><input type="checkbox" name="checkbox" value="checkbox" onClick="this.form.datum_vrijeme.value= TheDate.toLocaleString()"/></td>
    <td><input type='text' name='datum_vrijeme' value='{$datum_vrijeme}' readonly/>    </td>
    </tr>
    <tr>
    <td><input type="checkbox" name="checkbox1" value="checkbox" onClick="this.form.datum_vrijeme1.value=

this.form.datum_vrijeme.value"/></td>
    <td><input type='text' name='datum_vrijeme1' value='{$datum_vrijeme1}' readonly/>    </td>
    </tr>
    <tr>
    <td><input type="checkbox" name="checkbox2" value="checkbox" onClick="this.form.datum_vrijeme2.value=

this.form.datum_vrijeme.value"/></td>
    <td ><input type='text' name='datum_vrijeme2' value='{$datum_vrijeme2}' readonly/>    </td>
    </tr>
</table>
</form>

</body>
</html>

ak sam te dobro skužil.......
07-06-2008 05:43 PM
Find all posts by this user Quote this message in a reply
Son Goku Offline
Novi korisnik
*

Posts: 41
Joined: Jan 2008
Reputation: 0
Post: #3
RE: onclick trenutno vrijeme i datum
evo probao sam ovo sta si ti sad stavio i ista stvar je kao rezultat, znaci kad poklikam checkboxove prikaze mi se isto vrijeme na svakom. A ja bi htio da mi svaki prikaze drugacije vrijeme u textfieldu, tj vrijeme u koje sam kliknuo.

Kad npr. kliknem na prvi, u text field mi se upise 9. lipanj 2008 15:23:20. i kad kliknem na druga dva checkboxa isto to mi se upise. Ali ja hocu da ako sam na drugi kliknuo minutu kasnije da mi se upise to vrijeme, znaci 9. lipanj 2008 15:24:20., itd...
09-06-2008 03:28 PM
Find all posts by this user Quote this message in a reply
Son Goku Offline
Novi korisnik
*

Posts: 41
Joined: Jan 2008
Reputation: 0
Post: #4
Question RE: onclick trenutno vrijeme i datum
Help, moze li netko pomoci? Confused
11-06-2008 11:29 AM
Find all posts by this user Quote this message in a reply
Puž Offline
Redoviti posjetitelj
**

Posts: 132
Joined: Mar 2007
Reputation: 25
Post: #5
RE: onclick trenutno vrijeme i datum
Code:
<html>
<head>
<title>Datum / Vrijeme</title>

<script type="text/javascript">
function datum(kaj)
{
    var TheDate = new Date();
    document.getElementById(kaj).value=TheDate.toLocaleString()
}

</script>

</head>

<body>
<form id="forma" name="forma" >
<table border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td><input type="checkbox" name="checkbox" value="checkbox" onClick="datum('datum_vrijeme')"/></td>
    <td><input type='text' id='datum_vrijeme' value='{$datum_vrijeme}' readonly/>    </td>
    </tr>
    <tr>
    <td><input type="checkbox" name="checkbox1" value="checkbox" onClick="datum('datum_vrijeme1')"/></td>
    <td><input type='text' id='datum_vrijeme1' value='{$datum_vrijeme1}' readonly/>    </td>
    </tr>
    <tr>
    <td><input type="checkbox" name="checkbox2" value="checkbox" onClick="datum('datum_vrijeme2')"/></td>
    <td ><input type='text' name='datum_vrijeme2' value='{$datum_vrijeme2}' readonly/>    </td>
    </tr>
</table>
</form>

</body>
</html>
12-06-2008 10:47 AM
Find all posts by this user Quote this message in a reply
Son Goku Offline
Novi korisnik
*

Posts: 41
Joined: Jan 2008
Reputation: 0
Post: #6
RE: onclick trenutno vrijeme i datum
Hvala puno, to je to[Image: notworthy.gif][Image: notworthy.gif][Image: notworthy.gif][Image: notworthy.gif]. Zanimljivo, u IE rade svi, a u firefox samo prva 2Hammer
12-06-2008 11:57 AM
Find all posts by this user Quote this message in a reply
Puž Offline
Redoviti posjetitelj
**

Posts: 132
Joined: Mar 2007
Reputation: 25
Post: #7
RE: onclick trenutno vrijeme i datum
za ff zamjeni name='datum_vrijeme2' sa id='datum_vrijeme2'
13-06-2008 04:54 PM
Find all posts by this user Quote this message in a reply
Son Goku Offline
Novi korisnik
*

Posts: 41
Joined: Jan 2008
Reputation: 0
Post: #8
RE: onclick trenutno vrijeme i datum
Radi,super je, hvala puno jos jednom :)
17-06-2008 10:20 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)