Jump to content

davej

Moderator
  • Posts

    3,988
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by davej

  1. I still think the current situation is bad. We have a multitude of plain-text passwords flowing around the net.
  2. I think it is a fun idea to play with but the only solution that is considered secure is the use of a security certificate, and even the certificate system is being hacked on a regular basis though the use of bogus or stolen certificates.
  3. It's just a bad idea to use eval in Php or in Javascript unless you are an experienced code expert.
  4. I would suggest Java. You can download the JDK and a developer IDE here... http://www.oracle.com/technetwork/java/javase/downloads/jdk-netbeans-jsp-142931.html For security reasons Javascript is severely restricted when it comes to accessing files. Other options would be C# or Python. C++ is rather old and clunky.
  5. Both of these have been depreciated or rendered unnecessary in HTML5... language="javascript" type="text/javascript"
  6. Here is a somewhat related question... If I have a jQuery plugin defined like this... (function($) { $.fn.processImages = function() { return this.filter('img').each(function() { // process all the img elements inside the div }); // end each }; }( jQuery )); ...and I launch it like this... $(document).ready(function() { $("#myDiv").processImages(); // pass it the div which contains the images }); ...how do I change the plugin so that it will extract a list of images from within the selected div or divs? The filter function is not sufficient to accomplish this refined-selection. What I need is something like... $(this "img").each(function(){... ---EDIT--- I found the solution. An optional context can be used in a selector so that you don't begin searching at the document root. This is just what I needed in the event handler... $("img", this).each(function(){...
  7. Huh? Responsive means that the number of images per row will change depending on the width of the screen.
  8. You can't put double-quotes inside double-quotes and expect things to work right.
  9. I have mixed feeling about this. Yes the web is filled with example code, and yes, you can search for example code, or you can right-click on any webpage and view the source, but as a beginner the first thing you need are probably tutorials that explore one topic at a time. http://www.w3schools.com/html/default.asp
  10. You can do it all in one file. <!DOCTYPE html> <head lang="en"> <meta charset="UTF-8"> <title>test</title> <style> h1{color:red} </style> </head> <body> <h1>TEST</h1> <div id="msg"> </div> <script> var str = "<b>Hello World!</b>"; document.getElementById('msg').innerHTML = str; </script> </body> </html>
  11. Would it be practical to set up triggers on a MySQL database so that if anyone executes a drop or alter command a trigger would fire and record that event? I would then want to fire off an email to the admin. This is a Joomla website so there are about 160 tables. --edit-- No, apparently it isn't possible to assign a trigger to a drop or alter event. https://dev.mysql.com/doc/refman/5.7/en/create-trigger.html I guess an alternative might be a periodic stored procedure that runs a set of 160 queries that detect whether the size of any table has changed by more than some percentage.
  12. Tell them they need to cover HTML5, and CSS3, including Canvas and SVG.
  13. Can't you just download the website(s) and then compare it/them to a known good local copy?
  14. Well, you posted it here, so everyone is free to comment. Cross-browser differences have long been an issue, and now mobile devices have added their own quirks... http://www.quirksmode.org/
  15. davej

    new format

    I've pasted it into the original post.
  16. Use... clearInterval(gameInt); ...and... var gameInt = setInterval(draw, 10);
  17. Now I am thinking that they both return collections, but I don't understand how they differ.
  18. I have been looking at the examples here... https://learn.jquery.com/plugins/basic-plugin-creation/ ...but I am confused about the return values. Some examples seem to return collections such as... $.fn.myNewPlugin = function() { return this.each(function() { // Do something to each element here. }); }; ...but some seem to work on collection but (apparently) return only one item... (function( $ ) { $.fn.showLinkLocation = function() { this.filter( "a" ).each(function() { var link = $( this ); link.append( " (" + link.attr( "href" ) + ")" ); }); return this; }; }( jQuery )); ...or am I reading this wrong?
  19. Actually, you can assign event handlers to any element. <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"/> <title>title</title> <style> .buttons li{cursor:pointer;width:100px;border:1px solid #ccc;border-radius:5px;text-align:center;list-style:none;} .buttons li:hover{background-color:#999;} #one,#two{display:none;} </style> <script> 'use strict'; window.onload = init; function init() { var list = document.getElementsByClassName('buttons')[0].getElementsByTagName('LI'); for (var i=0 ; i<list.length ; i++){ list[i].onclick = clkHandler; } }// end of func function clkHandler(){ var txt = this.innerHTML.trim().toLowerCase(); var ele = document.getElementById(txt); ele.style.display = 'block'; if(txt == 'one'){ document.getElementById('two').style.display = 'none'; }else if(txt == 'two'){ document.getElementById('one').style.display = 'none'; }else{ alert('error in button handler'); } }// end of func </script> </head> <body> <div id="wrapper"> <nav class="buttons"> <ul> <li>ONE</li> <li>TWO</li> </ul> </nav> <div id="one"> <p>TEXT ONE</p> </div> <div id="two"> <p>TEXT TWO</p> </div> </div> </body> </html>
  20. One approach that you could play with would be to not run such a loop continuously, but run it in a periodic manner... var si = setInterval(myLoop, 200); function myLoop() { for(var i=0 ; i<5 ; i++){ console.log(i); } } ...and there is also the newest approach... http://www.w3schools.com/html/html5_webworkers.asp
  21. See... http://www.msn.com/en-us/money/technology/how-one-programmer-broke-the-internet-by-deleting-a-tiny-piece-of-code/ar-BBr1310?li=BBnb4R7&ocid=mailsignout
  22. This question seems vague to me. In Javascript 'null' is a value that can be assigned, but 'undefined' is the value of a variable that was never given a value. If typeof x == 'undefined' then the variable x was never declared. If x == 'undefined' then the variable x was declared but was never given a value. The == operator provides some type coercion while the === operator is a strict compare. <script> 'use strict'; window.onload = init; function init() { //var x; var y; var z = null; if (typeof x == 'undefined'){ alert('typeof x == "undefined" is true'); } if (typeof x === 'undefined'){ alert('typeof x === "undefined" is true'); } try{ alert('x = ' + x); }catch(e){ alert('Exception thrown: '+e.message); } } </script> ...I guess the question in the subject line is essentially a question about 'truthyness' https://developer.mozilla.org/en-US/docs/Glossary/Truthy ...because null and undefined are both 'falsy' values, but really who cares? This has little or no practical usefulness.
  23. Do you want it to loop forever? while(true){ for(var i=0 ; i<5 ; i++){ console.log(i); } } ...of course the browser might not be happy with this, because Javascript is intended to be event-driven and not a continuous user of processor time.
  24. e is an event object which is passed by the function parameter list. component is an object class which is apparently defined in the game. It isn't a reserved word in Javascript. Reserved words... http://www.w3schools.com/js/js_reserved.asp
×
×
  • Create New...