NYCPHP Meetup

NYPHP.org

[nycphp-talk] Javascript "select all" feature?

Phillip Powell phillip.powell at adnet-sys.com
Wed Apr 14 09:32:53 EDT 2004


Ok, back to the drawing board, it didn't work when my colleague tested 
on his machine using IE 6.0 SP4 for Win2K:

I tried with the HTML code below, but IE spat out the following:

Line: 42
Char: 1
Error: 'document.imageForm.move[]' is null or not an object
Code: 0
URL: file://C:\Documents and Settings\eduardo\Desktop\test.html

HTML code:

<html>
<head>
<title></title>
<body>
<script>
<!--
~ function selectAll(checkState, selectStatus, obj) {
~  if (document.imageForm.select_all.checked ||
document.imageForm.deselect_all.checked) {
~   for (i = 0; i < obj.length; i++) {
~    obj[i].checked = checkState;
~   }
~  if (selectStatus.toLowerCase() == 'select')
document.imageForm.deselect_all.checked = false;
~  if (selectStatus.toLowerCase() == 'deselect')
document.imageForm.select_all.checked = false;
~ }
}
//-->
</script>

<table>
<tr>
~ <td bgcolor=ffffff><a 
href="./images/mu-spin/kyrka.jpg">kyrka.jpg</a></td>
~ <td bgcolor=ffffff>Show Metadata</td>
~ <td bgcolor=ffffff><input type=checkbox name="move[]"
value="kyrka.jpg"> - Move?</td>

</tr>
<tr>
~ <td bgcolor=ffffcc><a
href="./images/mu-spin/banner.jpg.jpeg">banner.jpg.jpeg</a></td>
~ <td bgcolor=ffffcc><a
href=index.php?section=image&action=edit&chooseAlbum=1&album=mu-spin&id=147>Show 

Metadata</a></td>
~ <td bgcolor=ffffcc><input type=checkbox name="move[]"
value="banner.jpg.jpeg"> - Move?</td>
</tr>
<tr>

~ <td bgcolor=ffffff><a
href="./images/mu-spin/kyrka_gray.jpg">kyrka_gray.jpg</a></td>
~ <td bgcolor=ffffff><a
href=index.php?section=image&action=edit&chooseAlbum=1&album=mu-spin&id=145>Show 

Metadata</a></td>
~ <td bgcolor=ffffff><input type=checkbox name="move[]"
value="kyrka_gray.jpg"> - Move?</td>
</tr>
<tr>
~ <td colspan=3 bgcolor=ddddee>
~  <input type=checkbox name="select_all" value=1
onClick="selectAll(true, 'select', document.imageForm['move[]'])"> -
Select All&nbsp;&nbsp;<input type=checkbox name="deselect_all" value=1
onClick="selectAll(false, 'deselect', document.imageForm['move[]'])"> -
De-Select All</td>

</tr>
</table>
</body>
</html>





More information about the talk mailing list