Jump to content

davej

Moderator
  • Posts

    3,988
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by davej

  1. Why not just say o == 0 so that it is clear that o merely sequences 0,1, 2 ?
  2. Interesting. The onpageshow event seems to work if it is attached to the body.
  3. See... http://www.w3schools.com/js/js_objects.asp
  4. o will always be zero, because you just set it to zero, and zero is a falsy value, so !o will always yield a truthy value. Declare and initialize o outside the function, and don't use ! on a number.
  5. Why are you using a boolean operator on a number? Why would you expect a dynamic local variable to not be zero when you set it to zero?
  6. The browser back-arrow using the page you posted above? Have you tried... http://www.w3schools.com/tags/att_input_autocomplete.asp ...and... <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Expires" content="-1"> ...and if all else fails the Javascript I posted earlier would also work as long as Javascript has not been disabled.
  7. document.getElementsByTagName("DIV")[0].getElementsByTagName("P")[0]
  8. document.getElementsByTagName("DIV")[0]
  9. Are you working on www.futurebeacon.com?
  10. There appears to be a trick available in Javascript to detect touchscreens. http://stackoverflow.com/questions/11387805/media-query-to-detect-if-device-is-touchscreen <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"/> <title>title</title> <style> .touch .touch{ color:red; } .touch .notouch{ display:none; } .notouch .notouch{ color:red; } .notouch .touch{ display:none; } </style> <script> window.onerror = function(a,b,c){ alert('Javascript Error: '+a+'\nURL: '+b+'\nLine Number: '+c); return true; } </script> <script> 'use strict'; window.onload = function(){ if( 'ontouchstart' in document.documentElement ){ document.getElementsByTagName('BODY')[0].className += ' touch'; }else{ document.getElementsByTagName('BODY')[0].className += ' notouch'; } } </script> </head> <body> <div class="touch"> <h3>Touchscreen</h3> </div> <div class="notouch"> <h3>No Touchscreen</h3> </div> </body> </html>
  11. Why don't you write a simple test to see if the browsers in those devices respond to media queries? <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!--[if lt IE 9]> <script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script> <!--[endif]--> <title>media queries</title> <style> @media screen and (max-width: 100px) { #out0::after { content: " less than 100px"; } } @media screen and (min-width: 101px) and (max-width: 200px) { #out0::after { content: " between 101px and 200px"; } } @media screen and (min-width: 201px) and (max-width: 300px) { #out0::after { content: " between 201px and 300px"; } } @media screen and (min-width: 301px) and (max-width: 400px) { #out0::after { content: " between 301px and 400px"; } } @media screen and (min-width: 401px) and (max-width: 500px) { #out0::after { content: " between 401px and 500px"; } } @media screen and (min-width: 501px) and (max-width: 600px) { #out0::after { content: " between 501px and 600px"; } } @media screen and (min-width: 601px) and (max-width: 700px) { #out0::after { content: " between 601px and 700px"; } } @media screen and (min-width: 701px) and (max-width: 800px) { #out0::after { content: " between 701px and 800px"; } } @media screen and (min-width: 801px) and (max-width: 900px) { #out0::after { content: " between 801px and 900px"; } } @media screen and (min-width: 901px) and (max-width: 1000px) { #out0::after { content: " between 901px and 1000px"; } } @media screen and (min-width: 1001px) { #out0::after { content: " greater than 1000px"; } } </style> <script> window.onload = function(){ setInterval(put,1000); put(); } function put(){ var txt = '<br/>Javascript reports window width: '+ window.innerWidth +'px'; document.getElementById('out1').innerHTML = txt; } </script> </head> <body> <div id="out0"> CSS reports width is </div> <div id="out1"> </div> </body> </html>
  12. Simply take the code I provided above and place it in the head or body of the file.
  13. There is nothing here to restore those fields so it must be due to browser caching. You could add a script block... <script> window.onload = function(){ var i; var list = document.getElementsByTagName('INPUT'); for (i=0,len=list.length ; i<len ; i++){ if (list[i].type == 'text'){ list[i].value = ''; } } var list = document.getElementsByTagName('TEXTAREA'); for (i=0,len=list.length ; i<len ; i++){ list[i].value = ''; } } </script>
  14. But does this injection occur automatically or because of poorly written Php code? I'm reading this... http://www.html-form-guide.com/php-form/php-form-action-self.html ...but it doesn't explain why it happens.
  15. How did you size/style the buttons?
  16. But why does it matter if they send fake GET data if the Php code is going to look for POST data? The injected script can change the HTML but why would the Php care what the HTML says?
  17. I don't actually understand how this confuses the system... http://www.example.com/test_form.php/%22%3E%3Cscript%3Ealert('hacked')%3C/script%3E ...Why aren't the extra characters ignored or considered invalid? I could see that they might be confused as GET data but this code will be looking for a POST.
  18. I think it may be better to use action="" but certainly there is known problem with using $_SERVER["PHP_SELF"] http://www.w3schools.com/php/php_form_validation.asp
  19. davej

    break point?

    Adjust the @media min-width and max-width values in the layout.css file... http://www.w3schools.com/cssref/css3_pr_mediaquery.asp
  20. What about these obvious errors? Javascript is case-sensitive. XmlhttpRequest vs XMLHttpRequest /your key gose here/ jsop.parse vs JSON.parse document.getElementByID vs document.getElementById
  21. Compare these two and see why we keep saying that you should not use document.write. <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"/> <title>title</title> <script> window.onerror = function(a,b,c){ alert('Javascript Error:\n'+a+'\nFile: '+b+'\nLine: '+c); return true; } </script> </head> <body> <h3>Test</h3> <input type="button" id="btn1" value="Again"/><br/> <script> document.getElementById('btn1').onclick = rev; function rev(){ 'use strict'; var newString = ""; var theString = prompt("Enter a string for reversal",""); for (var counter=theString.length ; counter > 0 ; counter-- ) { newString += theString.substring(counter-1, counter); } document.write(theString + " reversed is " + newString + "!"); } rev(); </script> </body> </html> ...compare to... <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"/> <title>title</title> <script> window.onerror = function(a,b,c){ alert('Javascript Error:\n'+a+'\nFile: '+b+'\nLine: '+c); return true; } </script> </head> <body> <h3>Test</h3> <input type="button" id="btn1" value="Again"/><br/> <span id="outputspan"></span> <script> document.getElementById('btn1').onclick = rev; function rev(){ 'use strict'; var newString = ""; var theString = prompt("Enter a string for reversal",""); for (var counter=theString.length ; counter > 0 ; counter-- ) { newString += theString.substring(counter-1, counter); } document.getElementById('outputspan').innerHTML = theString + " reversed is " + newString + "!"; } rev(); </script> </body> </html>
  22. It looks like this Quick library hides the code from the global space. You need to assign the handlers to the buttons inside the code. <button id="btn1">goodHit</button> <button id="btn2">oop######</button> //button handlers document.getElementById('btn1').onclick = myFunction; document.getElementById('btn2').onclick = myFunction;
  23. For generic users of a website you are obviously limited to what is provided by the current browsers and servers, and that is SSL/TLS. http://httpd.apache.org/docs/2.4/ssl/ssl_intro.html
  24. davej

    masonry layout

    If it is your webpage, and your images, then why can't you simply RESIZE all of the images so that each group of images are exactly the same size? Then you wouldn't need Javascript to do anything.
×
×
  • Create New...