Deepa Kuruvilla

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromDeepa Kuruvilla
ToMe
SubjectProblem with form element array
Date22 November 2005 06:43
Sir,
    Would u please help me to solve my problem?
I am a php programmer.I have set of check boxes with same name and differnt
ids. i used for loop and assigned different names as follows

<input type="Checkbox" id="delete_<?=$row+1?>" name="delete[]"
value="<?=$country_id?>">

I dont want some of them satisfying certain condition and i put in use
instead of the chek box.

I used another check box to select all the check boxes i created in this
way.

Now I want to select all the check boxes if they exist. How i can do it?


Thanks in advance.
FromMe
ToDeepa Kuruvilla
SubjectRe: Problem with form element array
Date22 November 2005 10:19
Deepa,

> <input type="Checkbox" id="delete_<?=$row+1?>" name="delete[]"
> value="<?=$country_id?>">
>
> Now I want to select all the check boxes if they exist. How i can do it?

In JavaScript, the way to reference an element using its id is this:
document.getElementById('delete_3')

So you could use a for loop like this:
for( var i = 1, j; j = document.getElementById('delete_'+i); i++ ) {
  j.checked = true;
}


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromDeepa Kuruvilla
ToMe
SubjectRe: Problem with form element array
Date23 November 2005 08:54
Sir
Thanks for your reply. 
It helped me a lot to reduce the code and increase efficiency.
FromDeepa Kuruvilla
ToMe
Subject[blank subjects are not a good idea]
Date3 January 2006 06:52
sir 
1. how we can track the browser window close. I need to execute some code
when the user clicks on the "X"(close) button.
2. how to display a message when the user clicks on a link
FromMe
ToDeepa Kuruvilla
SubjectRe:
Date3 January 2006 09:55
Deepa,

> 1. how we can track the browser window close. I need to execute some
> code when the user clicks on the "X"(close) button.

I have discussed this problem in detail here:
http://www.howtocreate.co.uk/emails/GregBurman.html

> 2. how to display a message when the user clicks on a link

<a href="" onclick="alert('foo')">
FromDeepa Kuruvilla
ToMe
Subject
Date4 January 2006 06:41
sir

how we can track the browser window close. I need to execute some
code when the user clicks on the "X"(close) button.

i am not using a frame set.so i want a diffent solution.can we deal this
using clientX or ClientY.
FromMe
ToDeepa Kuruvilla
SubjectRe:
Date4 January 2006 09:58
Deepa,

> how we can track the browser window close. I need to execute some code
> when the user clicks on the "X"(close) button.
>
> i am not using a frame set.so i want a diffent solution.can we deal
> this using clientX or ClientY.

you cannot. and clientx/y is useless because it does not work cross browser.
you will either have to use a frameset, or abandon the idea.
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.