clear boxes

  • Thread starter Ben Dover - Mental Patient 0057
  • Start date
B

Ben Dover - Mental Patient 0057

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>
 
V

Vjekoslav Begovic

"Ben Dover - Mental Patient 0057"
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>
 
B

Ben Dover - Mental Patient 0057

Vjekoslav said:
"Ben Dover - Mental Patient 0057"
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.
...........


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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,575
Members
47,207
Latest member
HelenaCani

Latest Threads

Top