Jump to content

JMRKER

Members
  • Posts

    194
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by JMRKER

  1. For short sentences or data/text under 5M in size you might consider local storage. Note: It does not create a file that can be shared. Only saves to local client computer, not server.
  2. Regardless of native JS or JQuery, perhaps this would help with your understanding: <script> var globalVar = 'globalVar'; function parentFunc() { // no function parameters var parentVar = 'parentVar'; function childFunc() { // not function parameters var childVar = 'childVar'; alert('childFunc has access to:\n'+childVar+'\n'+parentVar+'\n'+globalVar); } childFunc(); alert('parentFunc has access to:\n'+parentVar+'\n'+globalVar); } alert('body has access to only:\n'+globalVar); parentFunc(); </script>
  3. One solution (of many) possible. <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title> setTimeout Displays </title> <!-- From: http://w3schools.invisionzone.com/topic/58090-using-settimeout-in-a-for-loop/ --> <style> .tips { display: none; } </style> </head> <body> <button id="startGuide"> Start Guide </button> <div id="tip0" class="tips"> Tip 1 </div> <div id="tip1" class="tips"> Tip 2 </div> <div id="tip2" class="tips"> Tip 3 </div> <div id="tip3" class="tips"> Tip 4 </div> <div id="tip4" class="tips"> Tip 5 </div> <div id="tip5" class="tips"> Tip 6 </div> <div id="tip6" class="tips"> Done </div> <div id="debug"><br><!-- tipCnt, if used --></div> <script> var startG = document.getElementById("startGuide"); var guidetips = []; guidetips[0] = document.getElementById("tip0"); guidetips[1] = document.getElementById("tip1"); guidetips[2] = document.getElementById("tip2"); guidetips[3] = document.getElementById("tip3"); guidetips[4] = document.getElementById("tip4"); guidetips[5] = document.getElementById("tip5"); guidetips[6] = document.getElementById("tip6"); var tip = '', tipCnt = 0, tipTime = 1000; function toggleTip(){ if (tipCnt < guidetips.length) { if (tipCnt > 0) { guidetips[tipCnt-1].style.display = 'none'; } clearTimeout(tip); tip = setTimeout('toggleTip()', tipTime); if (tipCnt < guidetips.length) { guidetips[tipCnt].style.display = 'block'; tipCnt++; } else { guidetips[tipCnt].style.display = 'none'; } } else { clearTimeout(tip); tipCnt = 0; } // document.getElementById('debug').innerHTML = tipCnt; // optional display } function init() { document.getElementById('startGuide').addEventListener('click', function() { toggleTip(); } ); } init(); </script> </body> </html>
  4. Sorry, but I did not see any requirement from OP that the code requested needed to be on a server, hence the initial question. Obviously the OP has his/her answer or has given up. Either way, no need to argue about requirements when either could work if there were more request clarification.
  5. Sorry, I understood your suggestion. I have used it in the past as well. What I was asking the OP for was clarification as to how the count request was to be used. Server (your solution) or client side (via local storage).
  6. Unclear on the request, so for clarification: Does the button count need to be stored on the server for counts from more than one user? Or, can the button count be saved (and/or reset) with local storage on the users single computer?
  7. JMRKER

    html columns

    You can simplify it even further ... <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title> HTML5 page </title> <style> .columnList2 { -webkit-column-count: 2; /* Chrome, Safari, Opera */ -moz-column-count: 2; /* Firefox */ column-count: 2; } ul { list-style: none; } </style> </head> <body> <ul class="columnList2"> <li>Mr. Smith</li> <li>123 Main</li> <li>Somewhere, CA 12345</li> <li>Ms. Baker</li> <li>456 Central</li> <li>Other City, FL 32165</li> </ul> </body> </html>
  8. JMRKER

    html columns

    Not sure how your data is formatted, but using JSON format as an example. You could modify the following to suit your needs (???). <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title> HTML5 page </title> <!--For: http://w3schools.invisionzone.com/topic/58061-html-columns/ --> <style> #customersInfo { width: 30em; border: 1px solid red; } #customersInfo > input { width: 15em; border: 0; background-color: yellow; margin: 0.5em; } </style> </head> <body> <p> Starting text </p> <fieldset id="customersInfo"> <legend for="customersInfo">Customers Information</legend> <input id="name0" value=""> <input id="name1" value=""> <br> <input id="addr0" value=""> <input id="addr1" value=""> <br> <input id="csz0" value=""> <input id="csz1" value=""> </fieldset> <p> More text </p> <script> var customers = [ {"name":"Mr. Smith", "addr":"123 Main", "city":"Somewhere", "st":"CA", "zip":"12345"}, {"name":"Ms Baker", "addr":"456 Central", "city":"Other City", "st":"FL", "zip":"32165"} ]; function doc(IDS) { return document.getElementById(IDS); } function init() { for (var i=0; i<customers.length; i++) { doc('name'+i).value = customers[i].name; doc('addr'+i).value = customers[i].addr; doc('csz'+i).value = customers[i].city+', '+customers[i].st+' '+customers[i].zip; } } init(); </script> </body> </html>
  9. Well, I'm glad it solved your problems, but I don't know how it did. Can you give an example of the HTML layout with 3 groups of 3 checkbox and show how clicking on 2 and 1 and 2 in each of the groups (A,B,C) makes a total of 9 checked boxes?
  10. Sure, why not? <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title> HTML5 page </title> <!-- link rel="stylesheet" href="common.css" media="screen" --> <style> fieldset { width: 10em; } </style> </head> <body> <fieldset id="GC"> <legend>Group Count</legend> <input type="checkbox" value="4"> 2<sup>2</sup> <input type="checkbox" value="2"> 2<sup>1</sup> <input type="checkbox" value="1"> 2<sup>0</sup> </fieldset> <input type="button" value="Submit Group Count" id="submit"> <script> function summate() { var sel = document.getElementById('GC').querySelectorAll('input'), sum = 0; for (var i=0; i<sel.length; i++) { if (sel[i].checked) { sum += Number(sel[i].value); } } // return sum; alert('Sum: '+sum); } function init() { document.getElementById('submit').addEventListener('click',summate); } init(); </script> </body> </html>
  11. I pointed out one error. Have you tested the program since? Are you experiencing additional problems? Is your project performing as expected?
  12. Don't know if there is a problem with your code as I don't see any questions. However, in your first four functions you define "blok" as a local variable in 3 of them and a global in the other. function verwijderLijn(demo) { blok = document.getElementById(demo); lijnen = blok.getElementsByTagName("hr"); if (lijnen.length > 0) { blok.removeChild(lijnen[lijnen.length - 1]); } } Was that intentional?
  13. Then why not ask in the PHP forum?
  14. What language are you trying to write with? Java or Javascript? There is not a native "print" function in Javascript. If the code is Java, then you would get better answers in that forum.
  15. As 'dsonesuk' says, have you tried this ... <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title> HTML5 page </title> <style> .hide { display: none; } </style> </head> <body> <button onclick="myFunction('myDIV')">Click Me</button> <div id="myDIV" class="hide"> This is my DIV element. </div> <script> function myFunction(info) { document.getElementById(info).classList.toggle('hide'); } </script> </body> </html>
  16. JMRKER

    charset

    Are you asking about this: https://www.w3schools.com/jsref/jsref_encodeURI.asp
  17. Unclear of the desired results. Can you expand on your design requirements? Perhaps a picture of what you are trying to accomplish? Or what is supposed to happen when a particular button is clicked?
  18. Have you tried this? <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title> HTML5 page </title> </head> <body> <div class="form-group"> <label class="col-sm-4 control-label">Checkbox inputs</label> <div class="col-sm-8"> <div class="checkbox check-transparent"> <label for="opt01">Option 1</label> <input type="checkbox" value="1" id="opt01" checked> </div> <div class="checkbox check-transparent"> <label for="opt02">Option 2</label> <input type="checkbox" value="1" id="opt02"> </div> <div class="checkbox check-transparent"> <label for="opt03">Option 3</label> <input type="checkbox" value="1" id="opt03"> </div> </div> <div> </body> </html>
×
×
  • Create New...