473,386 Members | 1,764 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,386 software developers and data experts.

checkbox in javascript

Hi,

I have a asp page.in that i hv created some checkboxes as:

<%for i=1 to c %>
<tr>
<td width="27%" align="right" class="TabBodyRalignBrdLess"></td>
<td class="TabBodyBrdrLess"><input type="text" name="namerecd<%=i%>" size="30%"></td>
<td class="TabBodyBrdrLess"><input type="text" name="locrecd<%=i%>" size="33%"></td>
<td class="TabBodyBrdrLess"><input type="checkbox" name="chk<%=i%>" /></td>
</tr>
<% next %>

i have the number of check boxes in hidden text box
now i want to check these checkboxes using javascript function:

but i donot know how to refer each check box

function shiftnames()
{
count=document.form1.hidetxt1.value;
alert(count);
for (i=1;i<=count;i++)
{
if (document.form1.chk+i+.checked==true)
{
// some lines
}
}
}

but the above if statement is not working

Please help me
it is very urgent

Thanks
May 16 '07 #1
3 1356
Instead of

Expand|Select|Wrap|Line Numbers
  1. document.form1.chk+i+.checked==true
  2.  
try

Expand|Select|Wrap|Line Numbers
  1. document.form1.elements["chk"+i].checked==true
  2.  
The former is effectively looking for a form element with name chk+1+ and not chk1.
May 17 '07 #2
Thanks a lot for ur suggestion.
this is working.
Regards
May 24 '07 #3
Please Help Me.....
This is the code i m using in the edit.asp page.....

<tr><td width="486" valign=top height="1">
<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" u-file="fpweb:///_private/form_results.csv" s-format="TEXT/CSV" s-label-fields="TRUE" --><p>
<input type="checkbox" name="Chkbox1" value="1"
<% if sr="True" then %>
checked="true"
<% else %>
unchecked="true"
<% end if %>
>RECEIVED
</form>
<p>


</td>
<td width="486" valign=top height="1">
<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" u-file="fpweb:///_private/form_results.csv" s-format="TEXT/CSV" s-label-fields="TRUE" --><p>
<input type="checkbox" name="Chkbox2" value="2"
<% if dr="True" then %>
checked="true"
<% else %>
unchecked="true"
<% end if %>
>RECEIVED
</form>


now in esave.asp page, following code is used.....

elseif mode="update" then

id = Request("frmid")

if ((Request.form("chkbox1") <> "") ) then
sql = "UPDATE tblGATEPASSn SET SRECD = '1' WHERE GP_ID='" & id & "'"
else
sql = " UPDATE tblGATEPASSn SET DRECD = '1' WHERE GP_ID='" & id & "' "
end if

oConnection.execute sql

end if


Here i m not able to update value of DRECD attribute of the table.

Please suggest the solution for the problem.
Jun 29 '07 #4

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

Similar topics

0
by: claudel | last post by:
Hi I have a newb PHP/Javascript question regarding checkbox processing I'm not sure which area it falls into so I crossposted to comp.lang.php and comp.lang.javascript. I'm trying to...
5
by: Leo J. Hart IV | last post by:
Hello, I'm hoping someone can help me out. I was wondering if the Enabled property of a CheckBox or RadioButton server control is stored in the ViewState. If not, is there some way to to add...
5
by: DotNetJunkies User | last post by:
1. i want to populate checkboxlist using javascript only at client side ....how can i do this..by populate word i mean that checkboxes should be checked or unchecked on some condition basis.......
2
by: UJ | last post by:
Is there a way with a asp:checkbox to run a JavaScript to display/hide text/input on the screen without doing a postback? I also need to be able to access the stuff at the server so I need to...
34
by: clinttoris | last post by:
Hello Experts, I have been told to post this in the Javascript forum as I want to do this client side just before my form gets submitted. Once the user clicks the submit button a javascript...
1
by: pleaseexplaintome | last post by:
I have a datagrid with checkboxes and I can check/uncheck the checkboxes to update a database by calling my oncheckchanged function. I would like to add popup asking the users if they are sure...
10
by: rn5a | last post by:
All the rows in a DataGrid, including the Header, are accompanied with a CheckBox. I want that when the CheckBox in the Header is checked, then all the CheckBoxes should automatically get checked....
4
by: mamun | last post by:
Hi All, I have the following situation and am looking for answer in C#. I have a datagrid and putting checkbox next to each record. In the header I have a Delete button. I want users to...
0
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.