469,352 Members | 2,119 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,352 developers. It's quick & easy.

clear boxes

I have these text boxes that start with a check box:
[X] [text_A_1] [text_A_2] [text_A_3] [text_A_4]
[X] [text_B_1] [text_B_2] [text_B_3] [text_B_4]
[X] [text_C_1] [text_C_2] [text_C_3] [text_C_4]
[X] [text_D_1] [text_D_2] [text_D_3] [text_D_4]
I want to clear boxes in a row.
user clicks on first check box, that row of text boxes clears
here's the code:
<html>
<head>
<script language='javascript'>
function clearItem(thisOne) {
var thatOne=3;
document.up_data.A[2].value='xx'
}
}
</script>
</head>
<body>
<form name="up_data" method="POST" action="notes.cgi">

<input type="checktext" name="chkA0" onclick='clearItem("A")'>
<input type="text" name="A1">
<input type="text" name="A2">
<input type="text" name="A3">
<input type="text" name="A4">

<input type="checktext" name="chkB0" onclick='clearItem("B")'>
<input type="text" name="B1">
<input type="text" name="B2">
<input type="text" name="B3">
<input type="text" name="B4">
..... etc...

<input type="submit"> <input type="reset">
</form>
Jul 20 '05 #1
2 4966

"Ben Dover - Mental Patient 0057"
<Be*******@psychiatric-center.Bellevue-Hospital.com> wrote in message
news:3F***************@psychiatric-center.Bellevue-Hospital.com...
I have these text boxes that start with a check box:
[X] [text_A_1] [text_A_2] [text_A_3] [text_A_4]
[X] [text_B_1] [text_B_2] [text_B_3] [text_B_4]
[X] [text_C_1] [text_C_2] [text_C_3] [text_C_4]
[X] [text_D_1] [text_D_2] [text_D_3] [text_D_4]
I want to clear boxes in a row.
user clicks on first check box, that row of text boxes clears
here's the code:
<html>
<head>
<script language='javascript'>
function clearItem(thisOne) {
var thatOne=3;
document.up_data.A[2].value='xx'
}
}
</script>
</head>
<body>
<form name="up_data" method="POST" action="notes.cgi">

<input type="checktext" name="chkA0" onclick='clearItem("A")'>
checktext???
<input type="text" name="A1">
<input type="text" name="A2">
<input type="text" name="A3">
<input type="text" name="A4">

<input type="checktext" name="chkB0" onclick='clearItem("B")'>
<input type="text" name="B1">
<input type="text" name="B2">
<input type="text" name="B3">
<input type="text" name="B4">
.... etc...

<input type="submit"> <input type="reset">
</form>


Try something like this:

<html>
<head>
<script language='javascript'>
function clearItem(thisOne){
var fset = document.getElementById(thisOne);
var inputs = fset.getElementsByTagName("input");
for (var i = 0; i<inputs.length; i++)
inputs.item(i).value="";
}
</script>
</head>
<body>
<form name="up_data" method="POST" action="notes.cgi">

<input type="checkbox" name="chkA0" onclick='clearItem("A")'>
<fieldset id="A">
<input type="text" name="A1">
<input type="text" name="A2">
<input type="text" name="A3">
<input type="text" name="A4">
</fieldset>
<br>

<input type="checkbox" name="chkB0" onclick='clearItem("B")'>
<fieldset id="B">
<input type="text" name="B1">
<input type="text" name="B2">
<input type="text" name="B3">
<input type="text" name="B4">
</fieldset>
<input type="submit"> <input type="reset">
</form>


Jul 20 '05 #2


Vjekoslav Begovic wrote:

"Ben Dover - Mental Patient 0057"
<Be*******@psychiatric-center.Bellevue-Hospital.com> wrote in message
news:3F***************@psychiatric-center.Bellevue-Hospital.com...
I have these text boxes that start with a check box:
[X] [text_A_1] [text_A_2] [text_A_3] [text_A_4] ..................
<form name="up_data" method="POST" action="notes.cgi">

<input type="checktext" name="chkA0" onclick='clearItem("A")'>
checktext???


checkbox. damn. can't believe I did that.
<input type="text" name="A1">
<input type="text" name="A2">
...........

Try something like this:

<html>
<head>
<script language='javascript'>
function clearItem(thisOne){
var fset = document.getElementById(thisOne);
var inputs = fset.getElementsByTagName("input");
for (var i = 0; i<inputs.length; i++)
inputs.item(i).value="";
}
</script>
</head>
<body>
<form name="up_data" method="POST" action="notes.cgi">

<input type="checkbox" name="chkA0" onclick='clearItem("A")'>
<fieldset id="A">
<input type="text" name="A1">
<input type="text" name="A2">
<input type="text" name="A3">
<input type="text" name="A4">
</fieldset>
<br>

<input type="checkbox" name="chkB0" onclick='clearItem("B")'>
<fieldset id="B">
<input type="text" name="B1">
<input type="text" name="B2">
<input type="text" name="B3">
<input type="text" name="B4">
</fieldset>
<input type="submit"> <input type="reset">
</form>


yup. that works.
thankx.
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by T. Wintershoven | last post: by
1 post views Thread by bestafor | last post: by
3 posts views Thread by yakuza | last post: by
32 posts views Thread by =?Utf-8?B?U2l2?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.