Chud37 Posted September 5, 2011 Share Posted September 5, 2011 Hello, I have a form generated by mySQL and PHP, and inside the form (named 'UpdateDB') each line has checkboxes, like so: <input type="checkbox" name="checkbox[]" value="96" onclick="highlight(this,'check_96')"> The onclick is to highlight the row, that works fine. However, I wrote a javascript function that toggles the select all the checkboxes or none. This is done by an image: <img src="img/select.png" align="top"> <a href="#" onClick="togBox('updateDB');"><img src="img/all.png" name="listToggle" align="top"></a> Easy, right? So heres the Javascript function that the above image (the 'none' part) links to: function togBox(form) { var myForm = document.forms[form]; document.listToggle.src=='http://gospeltruth.tv/admin/img/all.png' ? toggle = true : toggle = false; (toggle) ? document.listToggle.src='img/none.png' : document.listToggle.src='img/all.png'; for( var i=0; i < myForm.length; i++ ) { (toggle) ? myForm.elements[i].checked = 'checked' : myForm.elements[i].checked = ''; } } Its a brilliant function if I do say so myself, and this is what I dont get: yesterday, it was working fine, today, its not working at all. The image changes, but IE flags up the 'myForm.length' as an error. How was it working 2 days ago and not today, when I havent touched it? Can anybody advise why its not currently working? Thanks for your help, ~Chud37 Link to comment https://forums.phpfreaks.com/topic/246475-php-javascript-simple-question-really/ Share on other sites More sharing options...
Chud37 Posted September 6, 2011 Author Share Posted September 6, 2011 bump. BUMP BUMP BUMP. Link to comment https://forums.phpfreaks.com/topic/246475-php-javascript-simple-question-really/#findComment-1265957 Share on other sites More sharing options...
nogray Posted September 6, 2011 Share Posted September 6, 2011 Did you make another form with the name or id "form"? Link to comment https://forums.phpfreaks.com/topic/246475-php-javascript-simple-question-really/#findComment-1266033 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.