473,403 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

How can I save the value of textbox when it is written in javascript

Hi Sir,

Im just new in programming using javascript and php.Please help me. I have a problem here..Im doing a system using php and its important to have date and digital time inside a textbox whenever the page loads, so I used javascript to do that. The problem is i dont know how to call and save the value of the textbox. Can somebody help me..Thank You in Advance..
Here's the code..

<html>
<head>
<link rel = "stylesheet" href = "../study/style.css" type = "text/css">
<title>Free SMS</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

<form name="main">
<table width="100%" border="0" class="forumline">
<tr>
<td width="17%">Start Date/Time:</td>
<td width="33%"><input type="text" name="start">
</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</form>
<script>
function show2(){
var digital=new Date()
var month = digital.getMonth()
var dom = digital.getDate()
var year = digital.getYear()
var hours = digital.getHours()
var minutes=digital.getMinutes()
var seconds=digital.getSeconds()
var moy = new Array("01","02","03","04","05","06","07","08","09" ,"10","11","12")
year = (year+"").substring(2,4)


if (hours > 24){
// dn = "PM";
hours = hours -24;}
if (hours==0){
hours = 24;}
if (minutes<=9){ minutes = "0" + minutes}
if (seconds<=9){ seconds = "0" + seconds}
document.main.start2.value=moy[month]+"/" + dom + "/" +year+ " " + hours + ":" + minutes + ":" + seconds;
// document.main.clear.value =moy[month]+"/" + dom + "/" + year + " " + hours + ":" + minutes + ":" + seconds;
setTimeout("show2()",1000);
}
show2()
//-->
</script>
</body>
</html>
Dec 20 '06 #1
1 1812
ronverdonk
4,258 Expert 4TB
Posting Guidelines. Read carefully before you post in a forum!

JavaScript is running client side, PHP is running server side. So it is not just a question of saving it in a variable. You must pass it from the client to the server. One way of doing that is using httpRequest, thereby calling the server program and passing the value. The server program could then store it in a global array for later usage. When you use an Ajax library you don't have to code these httpRequests yourself, but you can call the Ajax library.

See the httpRequest tutorial at Calling a server-side Script without refreshing the page

Ronald :cool:
Dec 20 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Glenn M | last post by:
I have a shared XML file on a server . i also have one xslt file that performs a simple transform on in to view the data. now i want to have another page that lets users modify the shared xml...
1
by: JC | last post by:
I'm sure you've all seen the save scroll position from 4 guys from rolla which can be found here > http://aspnet.4guysfromrolla.com/articles/111704-1.aspx BUT try to get that to work AND still be...
6
by: kurt | last post by:
Hi all, I have something that has me stumped. I have a webform that has several text boxes. Each of these boxes has the textchanged set so when the user enters text and leaves the textbox, it...
1
by: conckrish | last post by:
Dear All, This is all about ASP.NET WEB APPLICATION. I have a Button and when i click that button,I need to open the File Dialog( Genearl Save AS Dialog) through Which i have to select the...
1
by: satish.vell | last post by:
Hi, I have a ASP.NET page inside which I toggle the display of a field using javascript. How can I save this display value between postbacks. Here is my code: <pre>
1
by: =?Utf-8?B?U2hhdw==?= | last post by:
I have a small GridView about max 10 rows and few columns. The columns are simple just a checkbox and a textbox and a bound name. The users don’t want to click “edit” button to edit and...
2
by: KC-Mass | last post by:
I have a form that is used to ID and then load Excel files into Access. I use labels on the form to record which file was last loaded. That was accomplished with a simple lblFileLoaded =...
6
by: john | last post by:
I have the following textbox setup with Text & ToolTip Bindings as follows; I'm using Visual Studio 2008 VB: <asp:TextBox ID="txtDay1" runat="server" Text='<%# Eval("Day1") %>'...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.