Jump to content

JMRKER

Members
  • Content count

    21
  • Joined

  • Last visited

  • Days Won

    1

JMRKER last won the day on June 23

JMRKER had the most liked content!

Community Reputation

4 Neutral

About JMRKER

  • Rank
    Newbie
  1. JMRKER

    alert for dropdown list

    Instead of using "alert"s everywhere, which will get verrrry frustrating, why not make the background of the element a color of warning (perhaps red or pink) until the elements has an acceptable response? Or put within a bordered element until filled?
  2. What is "eased"? If the user will "always reply 'yes'", why bother to have a button to start the event?
  3. Are you trying to bypass the user choices about what is allowed to be saved on his/her computer? If yes, you may lose a lot of users on your site regardless of the services you may provide. What is your purpose for this request?
  4. 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.
  5. JMRKER

    A Matter of Scope

    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>
  6. JMRKER

    Using setTimeout() in a for loop

    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>
  7. JMRKER

    Button counter save

    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.
  8. JMRKER

    Button counter save

    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).
  9. JMRKER

    Button counter save

    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?
  10. 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>
  11. 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>
  12. JMRKER

    few checkbox checked, but count as one

    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?
  13. JMRKER

    few checkbox checked, but count as one

    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>
  14. JMRKER

    Adding and Deleting

    I pointed out one error. Have you tested the program since? Are you experiencing additional problems? Is your project performing as expected?
  15. JMRKER

    Adding and Deleting

    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?
×