Help with JavaScript please

Bad threads go here

Help with JavaScript please

Post by Dezo on Sat Sep 13, 2008 11:59 am
([msg=11607]see Help with JavaScript please[/msg])

Hey all
I got a small question:

I need to build a HTML page that has a form with one submit button. When I click on the button, I need to stop the page from submitting and then add (under the button) t a paragraph with the current time and date.

I pretty much everything working here EXCEPT it does not show the time in numbers... it shows the time in words.

Heres the code

Code: Select all
   function v(){
   var today = new Date()
   var myDate = today.getHours()
   var myTime = today.getMinutes()
   var mySeconds = today.getSeconds()
      var myParagraph = document.createElement("p")
   var txt = document.createTextNode('today');
      return false;   


Code: Select all
<form name="myform" id="myform" action="javascript3.html" method="post" onsubmit="return v()">
   <div class="formBox">
      <label for="sample">User Info</label>
      <input type="text" name="sample" id="sample" value="" />
   <div class="formBox" id="bob">
      <input type="submit" name="btnSubmit" id="btnSubmit" value="Click Me" />

Any help would mean a lot to me. Been trying (I really have) from 9AM to 1pm -

New User
New User
Posts: 1
Joined: Sat Sep 13, 2008 11:54 am
Blog: View Blog (0)

Re: Help with JavaScript please

Post by Jimmy_xor on Sun Sep 14, 2008 5:52 am
([msg=11678]see Re: Help with JavaScript please[/msg])

Replace the line
var txt = document.createTextNode('today');
with the line
var txt = document.createTextNode(today);

Please be more specific about the time and date format if this isn't enough..
New User
New User
Posts: 22
Joined: Tue Apr 22, 2008 4:35 pm
Blog: View Blog (0)

Return to Graveyard

Who is online

Users browsing this forum: No registered users and 0 guests