Jump to content

dsonesuk

Members
  • Content count

    9,567
  • Joined

  • Last visited

  • Days Won

    15

dsonesuk last won the day on June 14

dsonesuk had the most liked content!

Community Reputation

792 Excellent

7 Followers

About dsonesuk

  • Rank
    w3schools Guru
  • Birthday July 15

Recent Profile Visitors

93,218 profile views
  1. dsonesuk

    few checkbox checked, but count as one

    <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" id="viewport" content="target-densitydpi=high-dpi,initial-scale=1.0"> <title>Document Title</title> <style> #wrap {width: 20%; margin: 0 auto;} /* form {border:3px solid #ccc; padding: 15px; margin: 10px;}*/ form > table {width: 100%;} .single-count{} .text-right{text-align: right;} .vert-middle {vertical-align: middle; text-align: center;} </style> </head> <body> <div id="wrap"> <form name="myForm" action="#"> <table border="1" cellpadding="2" cellspacing="2"> <tr> <td style="width:80%;">(YB)Go/Walk-To/From</td> <td style="width:10%;"><input class="single-count" type="checkbox" name="chkboxGrp0[]" value="1" /></td> <td class="vert-middle" style="width:10%;">0</td> </tr> <tr> <td>(YB)Bring-Stack-Comic</td> <td><input class="single-count" type="checkbox" name="chkboxGrp1[]" value="1" /></td> <td class="vert-middle">0</td> </tr> <tr> <td colspan="3">(YB)Pick-up</td> </tr> <tr> <td class="text-right">TV-Remote</td> <td><input class="single-count" type="checkbox" name="chkboxGrp2[]" value="1" /></td> <td class="vert-middle" rowspan="4">0</td> </tr> <tr> <td class="text-right">Cup & Cookies</td> <td><input class="single-count" type="checkbox" name="chkboxGrp2[]" value="1" /></td> </tr> <tr> <td class="text-right">Comic</td> <td><input class="single-count" type="checkbox" name="chkboxGrp2[]" value="1" /></td> </tr> <tr> <td class="text-right">Video-Controller</td> <td><input class="single-count" type="checkbox" name="chkboxGrp2[]" value="1" /></td> </tr> <tr> <td>(YB)Hold-Milk-Carton</td> <td><input class="single-count" type="checkbox" name="chkboxGrp3[]" value="1" /></td> <td class="vert-middle">0</td> </tr> <tr> <td>(YB)Pour-Cup</td> <td><input class="single-count" type="checkbox" name="chkboxGrp4[]" value="1" /></td> <td class="vert-middle">0</td> </tr> <tr> <td colspan="3">(YB)Carry-X</td> </tr> <tr> <td class="text-right">Cup & Cookies</td> <td><input class="single-count" type="checkbox" name="chkboxGrp5[]" value="1" /></td> <td class="vert-middle" rowspan="3">0</td> </tr> <tr> <td class="text-right">Comic</td> <td><input class="single-count" type="checkbox" name="chkboxGrp5[]" value="1" /></td> </tr> <tr> <td class="text-right">Video-Controller</td> <td><input class="single-count" type="checkbox" name="chkboxGrp5[]" value="1" /></td> </tr> <tr> <td colspan="3">(YB)Hold-X</td> </tr> <tr> <td class="text-right">TV-Remote</td> <td><input class="single-count" type="checkbox" name="chkboxGrp6[]" value="1" /></td> <td class="vert-middle" rowspan="3">0</td> </tr> <tr> <td class="text-right">Cup & Cookies</td> <td><input class="single-count" type="checkbox" name="chkboxGrp6[]" value="1" /></td> </tr> <tr> <td class="text-right">Video-Controller</td> <td><input class="single-count" type="checkbox" name="chkboxGrp6[]" value="1" /></td> </tr> <tr> <td colspan="2" style="font-weight: bolder;" class="text-right">Total Group Selected</td> <td style="text-align: center; font-weight: bolder;" class="text-right"><span id="chkboxGroupCount">0</span></td> </tr> </table> </form> <div>Selected: <span id="chkboxSelected">None!</span></div> </div> <script> var chkbox = document.getElementsByClassName('single-count'); var chkboxTotal = document.getElementsByClassName('vert-middle'); for (var i = 0; i < chkbox.length; i++) { chkbox[i].checked = false; chkbox[i].addEventListener('click', chkboxGrpCount); } function chkboxGrpCount() { for (var i = 0; i < chkboxTotal.length; i++) { chkboxTotal[i].innerHTML = "0"; } var inputNameArray = []; for (var i = 0; i < chkbox.length; i++) { var chkBoxNameStripSqrBraces = chkbox[i].name.replace('[]', ''); if (inputNameArray.indexOf(chkBoxNameStripSqrBraces) === -1 && chkbox[i].checked === true) { chkboxTotal[parseInt(chkBoxNameStripSqrBraces.replace('chkboxGrp', ''))].innerHTML = "1"; inputNameArray.push(chkBoxNameStripSqrBraces); } } document.getElementById('chkboxGroupCount').innerHTML = inputNameArray.length; if (inputNameArray.length === 0) { document.getElementById('chkboxSelected').innerHTML = "None!"; document.getElementById('chkboxSelected').style.color = "black"; } else { document.getElementById('chkboxSelected').innerHTML = inputNameArray.toString(); } if (inputNameArray.length !== chkboxTotal.length) { document.getElementById('chkboxSelected').style.color = "red"; } else { document.getElementById('chkboxSelected').innerHTML = "ALL Selected"; } } </script> </body> </html>
  2. dsonesuk

    few checkbox checked, but count as one

    If you mean three different attribute named grouped value checkbox inputs of three of each <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" id="viewport" content="target-densitydpi=high-dpi,initial-scale=1.0"> <title>Document Title</title> <style> #wrap {width: 20%; margin: 0 auto;} form {border:3px solid #ccc; padding: 15px; margin: 10px;} .single-count{} </style> </head> <body> <div id="wrap"> <form name="myForm" action="#"> <label>chkboxGrp1</label> <input class="single-count" type="checkbox" name="chkboxGrp1[]" value="1" /> <input class="single-count" type="checkbox" name="chkboxGrp1[]" value="2" /> <input class="single-count" type="checkbox" name="chkboxGrp1[]" value="3" /> <hr> <label>chkboxGrp2</label> <input class="single-count" type="checkbox" name="chkboxGrp2[]" value="4" /> <input class="single-count" type="checkbox" name="chkboxGrp2[]" value="5" /> <input class="single-count" type="checkbox" name="chkboxGrp2[]" value="6" /> <hr> <label>chkboxGrp3</label> <input class="single-count" type="checkbox" name="chkboxGrp3[]" value="7" /> <input class="single-count" type="checkbox" name="chkboxGrp3[]" value="8" /> <input class="single-count" type="checkbox" name="chkboxGrp3[]" value="9" /> </form> <div>Checkbox group total selected: <span id="chkboxGroupCount">0</span></div> <div>Selected: <span id="chkboxSelected"></span></div> </div> <script> var chkbox = document.getElementsByClassName('single-count'); for (var i = 0; i < chkbox.length; i++) { chkbox[i].addEventListener('click', chkboxGrpCount); } function chkboxGrpCount() { var inputNameArray = []; for (var i = 0; i < chkbox.length; i++) { var chkBoxNameStripSqrBraces = chkbox[i].name.replace('[]', ''); if (inputNameArray.indexOf(chkBoxNameStripSqrBraces) === -1 && chkbox[i].checked === true) { inputNameArray.push(chkBoxNameStripSqrBraces); } } document.getElementById('chkboxGroupCount').innerHTML = inputNameArray.length; document.getElementById('chkboxSelected').innerHTML = inputNameArray.toString(); } </script> </body> </html>
  3. dsonesuk

    = vs like

    If that is exactly what you use, then maybe you should try it without the semicolon within the SQL query
  4. dsonesuk

    few checkbox checked, but count as one

    I don't see how that would work with 3 different named groups of checkboxes? it sums up selected checkbox values of groups, not the number of groups selected.
  5. dsonesuk

    session_start(): cannot send session cache limiter

    Do you call the header() function, use php cookies, anywhere in your other scripts.
  6. dsonesuk

    session_start(): cannot send session cache limiter

    It is at the very top of document before the doctype and any html whatsoever, yes! Also none of the other included files do not include session_start() either, yes! And theres definitely no line break, space before <?php or space after. Any of these will cause already open header error.
  7. dsonesuk

    Links behind DIV don't work on iOS

    I can't do anything with this in its present state, old wrong Doctype!, old deprecated CSS and html, misplaced script tag, no unit value for CSS property, invalid CSS property definition. The doctype should be adjusted to represent current HTML5 document doctype ('<!doctype html>'), some of the new CSS you are attempting to use, will only work with HTML5, this also means you will have to use supported CSS and HTML as well.
  8. dsonesuk

    Block Size

    Considering block-size is experimental and only works for Firefox browsers, why even think of using it? Also you can't use div within table how you have shown, only outside the table or within a table td element, which also must be within a tr element to take the text 'example#'.
  9. dsonesuk

    hex to binary conversion understanding

    That is how numbers are formatted, leading 0s will always be removed, unless you convert to text string.
  10. dsonesuk

    JAVASCRIPT nodeList/nodeCollection

    Both work exactly the same if used correctly, with nodeValue you have to access the parent element text node first using childNode[0] then nodeValue (childNode[0].nodeValue), with .innerHTML its simple needs a reference to parent element in question to add or retrieve text within it.
  11. dsonesuk

    JAVASCRIPT nodeList/nodeCollection

    Yes! spaces are Text nodes, if you want to be element specific only, use '.children' instead function a(index) { var d = elements[index]; alert("Children length: " + d.children.length); alert(d.children[1].nodeName); alert("childNodes length " + d.childNodes.length); alert(d.childNodes[1].nodeName); }
  12. dsonesuk

    JAVASCRIPT nodeList/nodeCollection

    You can see this, using function a(index) { var d = elements[index].childNodes for (i = 0; i < d.length; i++) { alert(d[i].nodeName); } }
  13. dsonesuk

    JAVASCRIPT nodeList/nodeCollection

    The reason it does not give the result you expect, is because any line breaking or stacking of html is treated as a space, and these or any spaces present is treated as a text node
  14. dsonesuk

    Links behind DIV don't work on iOS

    Sounds like Voodoo magic! unless you have an element overlapping somehow. Maybe you should supply link so we can actually see this black magic effect at work.
  15. dsonesuk

    iframe custom scrollbar

    have you tried overflow-y: auto; overflow-x: hidden;
×