my submit button stoped working after chaigng id to id[]

Joined
Jun 30, 2005
Messages
59
Reaction score
0
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;

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:


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

checkbox code :

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top