Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > BOOK: Beginning JavaScript
|
BOOK: Beginning JavaScript
This is the forum to discuss the Wrox book Beginning JavaScript by Paul Wilton; ISBN: 9780764544057
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning JavaScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 20th, 2006, 08:55 PM
Friend of Wrox
 
Join Date: Mar 2005
Posts: 264
Thanks: 0
Thanked 0 Times in 0 Posts
Default my submit button stoped working after chaigng id t

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>
Code:
          <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 :

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable Submit Button w/OnClientClick: Not Working kwilliams ASP.NET 2.0 Professional 4 August 25th, 2008 12:00 PM
Make a image button as default submit button toshi ASP.NET 1.0 and 1.1 Basics 1 June 1st, 2006 05:25 AM
Submit Button trusslady Infopath 2 January 6th, 2006 05:19 PM
submit-button grstad Javascript How-To 1 May 25th, 2005 08:33 AM
Submit Button Night_Zero Classic ASP Databases 1 August 17th, 2004 04:55 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.