Question : javascript starts with

See the attached javascript.

How can I change it so instead of saying select the checkboxes that are equal to

checkbox_add<?php echo $row_rs_media['media_group_id']; ?>

to

Select checkboxes that start with

checkbox_add<?php echo $row_rs_media['media_group_id']; ?>

Thanks

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
<script>
  function checkall<?php echo $row_rs_media['media_group_id']; ?>()
  {
      var groupa= document.getElementsByName("checkbox_add<?php echo $row_rs_media['media_group_id']; ?>");
      for(i=0;i<groupa.length;i++)
      groupa[i].checked=true;

  }
   function uncheckall<?php echo $row_rs_media['media_group_id']; ?>()
  {
      var groupa= document.getElementsByName("checkbox_add<?php echo $row_rs_media['media_group_id']; ?>");
      for(i=0;i<groupa.length;i++)
      groupa[i].checked=false;

  }
  </script>

Answer : javascript starts with

Here
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
<script>
function getElementsByTagNameLike(tag, nameLike){
  var e = document.getElementsByTagName(tag);
  for (i=0;i<e.length;i++) {
    if (e[i].name.indexOf(nameLike)==0) e[i].checked=true; 
  }
  
}
</script>

<a href="#" onClick="getElementsByTagNameLike('input', 'special'); return false">Select Group</a>

<br /><br />

<input type=checkbox name="special">1
<input type=checkbox name="special1">2
<input type=checkbox name="special2">3
<input type=checkbox name="other11">4
<input type=checkbox name="special12">5
<input type=checkbox name="special">6
Random Solutions  
 
programming4us programming4us