Solved

copy the contains to another textbox...

Posted on 2003-12-08
6
412 Views
Last Modified: 2006-11-17
hi, i am new to the javascript and run out of sample on doing the method mentioed above.

I have this text box,
<input type="text" name="date1" maxlength="10" />

and
<input type="text" name="date2" maxlength="10" />
<input type="text" name="date3" maxlength="10" />
<input type="text" name="date4" maxlength="10" />

After user enter the "date1"s value, i wish i can copy yhe contain into date2, date3 and date4.

how can i do such?
0
Comment
Question by:fks2
  • 4
6 Comments
 
LVL 33

Expert Comment

by:sajuks
ID: 9902195
try this

<!doctype html public "-//w3c//dtd html 3.2//en">

<html>

<head>

<script>
function setvalue(vdata)
{
date2.value = vdata;
date3.value = vdata;
date4.value = vdata;

}
</script>
</head>

<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
<input type="text" name="date1" maxlength="10" onblur = "setvalue(this.value)" />

<input type="text" name="date2" maxlength="10" />
<input type="text" name="date3" maxlength="10" />
<input type="text" name="date4" maxlength="10" />



</body>

</html>
0
 

Author Comment

by:fks2
ID: 9902801
sajuka, something wrong...

this is my real code:

...
function setvalue(vdata)
{
InsDateA.value = vdata;
InsDateB.value = vdata;
InsDateC.value = vdata;

}
...
...
//date1
 <td>Date of Purchase :</td>
    <td><input type="text" name="dop" onblur = "setvalue(this.value)"  />
    <a href="javascript:show_calendar('customer.dop');"
    onmouseover="window.status='DatePicker'; return true;"
    onmouseout="window.status='';return true;">
    <img src="face.jpg" width=24 height=22 border=0></a>
    </td>
...
...
...
    <td><input type="text" name="InsDateA" />
         <a href="javascript:show_calendar('customer.InsDateA');"
        onmouseover="window.status='DatePicker'; return true;"
        onmouseout="window.status='';return true;">
        <img src="face.jpg" width=24 height=22 border=0></a>
    </td>
...
...
    <td><input type="text" name="InsDateB" />
         <a href="javascript:show_calendar('customer.InsDateB');"
        onmouseover="window.status='DatePicker'; return true;"
        onmouseout="window.status='';return true;">
        <img src="face.jpg" width=24 height=22 border=0></a>
    </td>

it's prompt me the InsDateA is undefined.... how to define?I am gettig the InsDateA from the form itself.

0
 
LVL 33

Expert Comment

by:sajuks
ID: 9903107
If it is in a form say
<form name ="frm">
</form>

function setvalue(vdata)
{
document.frm.InsDateA.value = vdata;
document.frm.InsDateB.value = vdata;
document.frm.InsDateC.value = vdata;

}
HTH
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 33

Accepted Solution

by:
sajuks earned 125 total points
ID: 9903116
try this example:

<!doctype html public "-//w3c//dtd html 3.2//en">

<html>

<head>

<script>
function setvalue(vdata)
{
document.frm.date2.value = vdata;
document.frm.date3.value = vdata;
document.frm.date4.value = vdata;

}
</script>
</head>

<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
<form name ="frm">
<td>Date of Purchase :</td>
<td><input type="text" name="date1" maxlength="10" onblur = "setvalue(this.value)" /></td>

<td><input type="text" name="date2" maxlength="10" /></td>
<td><input type="text" name="date3" maxlength="10" /></td>
<td><input type="text" name="date4" maxlength="10" /></td>
</form>

</body>

</html>

0
 
LVL 33

Expert Comment

by:sajuks
ID: 9903126
Your code might look like this:


<!doctype html public "-//w3c//dtd html 3.2//en">

<html>

<head>

<script>
function setvalue(vdata)
{
document.frm.InsDateA.value = vdata;
document.frm.InsDateB.value = vdata;

}
</script>
</head>

<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
<form name ="frm">
<td>Date of Purchase :</td>
<td><input type="text" name="dop" onblur = "setvalue(this.value)" />
<a href="javascript:show_calendar('customer.dop');"
onmouseover="window.status='DatePicker'; return true;"
onmouseout="window.status='';return true;">
<img src="face.jpg" width=24 height=22 border=0></a>
</td>


<td><input type="text" name="InsDateA" />
<a href="javascript:show_calendar('customer.InsDateA');"
onmouseover="window.status='DatePicker'; return true;"
onmouseout="window.status='';return true;">
<img src="face.jpg" width=24 height=22 border=0></a>
</td>


<td><input type="text" name="InsDateB" />
<a href="javascript:show_calendar('customer.InsDateB');"
onmouseover="window.status='DatePicker'; return true;"
onmouseout="window.status='';return true;">
<img src="face.jpg" width=24 height=22 border=0></a>
</td>


</form>

</body>

</html>

0
 
LVL 7

Expert Comment

by:gam3r_3xtr3m3
ID: 9903525
this updates everything wherever textbox you type into:

<html>
<head>
<script>
function setvalue(vdata)
{document.frm.dop.value = vdata;
document.frm.InsDateA.value = vdata;
document.frm.InsDateB.value = vdata;}
</script>
</head>
<body>
<form name ="frm">
<table><tr>
<td>Date of Purchase :</td>
<td><input type="text" name="dop" onblur="setvalue(this.value)" />
<a href="javascript:show_calendar('customer.dop');"
onmouseover="window.status='DatePicker'; return true;"
onmouseout="window.status='';return true;">
<img src="face.jpg" width="24" height="22" border="0" /></a>
</td>
<td><input type="text" name="InsDateA" onblur="setvalue(this.value)" />
<a href="javascript:show_calendar('customer.InsDateA');"
onmouseover="window.status='DatePicker'; return true;"
onmouseout="window.status='';return true;">
<img src="face.jpg" width="24" height="22" border="0" /></a>
</td>
<td><input type="text" name="InsDateB" onblur="setvalue(this.value)" />
<a href="javascript:show_calendar('customer.InsDateB');"
onmouseover="window.status='DatePicker'; return true;"
onmouseout="window.status='';return true;">
<img src="face.jpg" width="24" height="22" border="0" /></a>
</td>
</tr></table>
</form>
</body>
</html>
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now