Subject: my submit button stoped working after chaigng id t
Posted By: method Post Date: 2/20/2006 7:55:59 PM
Hi all i have problem with my java script that stoped working after chaning check box name from id to id[].

 In one page i have 3 buttons. one that uses javascript to send songs to another page via url get method. One that submits check box values to next page via post .The 3th one clears the checkboxes.The problem is after changing the checkbox name Id to Id[] my other button that uses java script stoped working . . i need to keep the check box name as id[] since my other button will not work without [].I encluded the code bellow.I be happy if i get help fixing this poblem so that both buttons works.Thanks

java script code;

<script language="javascript">
<!-- hide
var checkflag = "false";
function check(field) {
if (checkflag == "false") {
for (i = 0; i < field.length; i++) {
field[i].checked = true;}
checkflag = "true";
return "Uncheck All"; }
else {
for (i = 0; i < field.length; i++) {
field[i].checked = false; }
checkflag = "false";
return "Check All"; }
}

function newWindow(url) { 
 var x,y;
 x = screen.width-35;
 y = screen.height-30;
 var win = window.open(url,'glossaryWindow','toolbar=no,directories=no,width=500,height=150'+
 'screenX=0,screenY=0,top=0,left=0,location=no,status=no,scrollbars=no,resize=yes,menubar=no');
}  

// Start of Playme Function
function playme()
{
Id = document.forms.mp3Play.Id;
tempUrl ='';
url = '';

if (Id.length > 0){  
 for (i=0; i<Id.length; ++ i)
 {
  if (Id[i].checked)
 {
  tempUrl =tempUrl +"|" + Id[i].value
  if (i == 30)
  {
   alert("Each time you can only select 30 songs to play")
   return false;
  }
 }
 }
}
else
 {
  alert("it is less than 0#2")
  tempUrl = tempUrl + "&Id=" + Id.value
 }
 //alert(tempUrl);
 url = "./mp3s/myWimpy.php?queryWhere=Id&queryValue=" + tempUrl;
 newWindow(url);
 return false;
}  
// End of Playme Function 
// --> 
</script>



checkbox page cuttons:


 
  <tr>
          <td colspan=7>
                            <p align="center">
                            <input type=button value="Check All" onClick="this.value=check(this.form.Id)"> &nbsp;&nbsp;
                            <button id="playSelected" onclick="playme()">Play Selected</button>&nbsp;&nbsp;                            <input type="submit" value="Add to PlayList [Members]" name="B1">&nbsp;&nbsp;
                            </td>
        </tr>


checkbox code :


<input
                        type="checkbox" name="Id[]" value='<?=intval( $row['id'] );?>' /></td>



Go to topic 40331

Return to index page 364
Return to index page 363
Return to index page 362
Return to index page 361
Return to index page 360
Return to index page 359
Return to index page 358
Return to index page 357
Return to index page 356
Return to index page 355