fks2
asked on
copy the contains to another textbox...
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?
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?
ASKER
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_cale ndar('cust omer.dop') ;"
onmouseover="window.status ='DatePick er'; 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_cale ndar('cust omer.InsDa teA');"
onmouseover="window.status ='DatePick er'; 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_cale ndar('cust omer.InsDa teB');"
onmouseover="window.status ='DatePick er'; 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.
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_cale
onmouseover="window.status
onmouseout="window.status=
<img src="face.jpg" width=24 height=22 border=0></a>
</td>
...
...
...
<td><input type="text" name="InsDateA" />
<a href="javascript:show_cale
onmouseover="window.status
onmouseout="window.status=
<img src="face.jpg" width=24 height=22 border=0></a>
</td>
...
...
<td><input type="text" name="InsDateB" />
<a href="javascript:show_cale
onmouseover="window.status
onmouseout="window.status=
<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.
If it is in a form say
<form name ="frm">
</form>
function setvalue(vdata)
{
document.frm.InsDateA.valu e = vdata;
document.frm.InsDateB.valu e = vdata;
document.frm.InsDateC.valu e = vdata;
}
HTH
<form name ="frm">
</form>
function setvalue(vdata)
{
document.frm.InsDateA.valu
document.frm.InsDateB.valu
document.frm.InsDateC.valu
}
HTH
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Your code might look like this:
<!doctype html public "-//w3c//dtd html 3.2//en">
<html>
<head>
<script>
function setvalue(vdata)
{
document.frm.InsDateA.valu e = vdata;
document.frm.InsDateB.valu e = 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_cale ndar('cust omer.dop') ;"
onmouseover="window.status ='DatePick er'; 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_cale ndar('cust omer.InsDa teA');"
onmouseover="window.status ='DatePick er'; 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_cale ndar('cust omer.InsDa teB');"
onmouseover="window.status ='DatePick er'; return true;"
onmouseout="window.status= '';return true;">
<img src="face.jpg" width=24 height=22 border=0></a>
</td>
</form>
</body>
</html>
<!doctype html public "-//w3c//dtd html 3.2//en">
<html>
<head>
<script>
function setvalue(vdata)
{
document.frm.InsDateA.valu
document.frm.InsDateB.valu
}
</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_cale
onmouseover="window.status
onmouseout="window.status=
<img src="face.jpg" width=24 height=22 border=0></a>
</td>
<td><input type="text" name="InsDateA" />
<a href="javascript:show_cale
onmouseover="window.status
onmouseout="window.status=
<img src="face.jpg" width=24 height=22 border=0></a>
</td>
<td><input type="text" name="InsDateB" />
<a href="javascript:show_cale
onmouseover="window.status
onmouseout="window.status=
<img src="face.jpg" width=24 height=22 border=0></a>
</td>
</form>
</body>
</html>
this updates everything wherever textbox you type into:
<html>
<head>
<script>
function setvalue(vdata)
{document.frm.dop.value = vdata;
document.frm.InsDateA.valu e = vdata;
document.frm.InsDateB.valu e = vdata;}
</script>
</head>
<body>
<form name ="frm">
<table><tr>
<td>Date of Purchase :</td>
<td><input type="text" name="dop" onblur="setvalue(this.valu e)" />
<a href="javascript:show_cale ndar('cust omer.dop') ;"
onmouseover="window.status ='DatePick er'; 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.valu e)" />
<a href="javascript:show_cale ndar('cust omer.InsDa teA');"
onmouseover="window.status ='DatePick er'; 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.valu e)" />
<a href="javascript:show_cale ndar('cust omer.InsDa teB');"
onmouseover="window.status ='DatePick er'; return true;"
onmouseout="window.status= '';return true;">
<img src="face.jpg" width="24" height="22" border="0" /></a>
</td>
</tr></table>
</form>
</body>
</html>
<html>
<head>
<script>
function setvalue(vdata)
{document.frm.dop.value = vdata;
document.frm.InsDateA.valu
document.frm.InsDateB.valu
</script>
</head>
<body>
<form name ="frm">
<table><tr>
<td>Date of Purchase :</td>
<td><input type="text" name="dop" onblur="setvalue(this.valu
<a href="javascript:show_cale
onmouseover="window.status
onmouseout="window.status=
<img src="face.jpg" width="24" height="22" border="0" /></a>
</td>
<td><input type="text" name="InsDateA" onblur="setvalue(this.valu
<a href="javascript:show_cale
onmouseover="window.status
onmouseout="window.status=
<img src="face.jpg" width="24" height="22" border="0" /></a>
</td>
<td><input type="text" name="InsDateB" onblur="setvalue(this.valu
<a href="javascript:show_cale
onmouseover="window.status
onmouseout="window.status=
<img src="face.jpg" width="24" height="22" border="0" /></a>
</td>
</tr></table>
</form>
</body>
</html>
<!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>