Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. You don;t need bind_param, because your query has no parameters.
  2. You should check the response of the HTTP request to see if a PHP error message shows up. Remember that functions in Javascript are case sensitive. showuser and showUser are two different identifiers.
  3. I would ignore the Netbeans error, but you must not put variables directly into SQL queries, use prepared statements: http://www.w3schools.com/php/php_mysql_prepared_statements.asp What errors are you getting when you run the code? "Doesn't work" is not very descriptive.
  4. Mobile first is the preferred approach these days, but it would be good to list the actual reasons rather than just blindly following the crowd. It is also not logical to start from small to big, it is merely conventional. Logic only works if you start off with premises that are true. From my experience, both mobile first and desktop first approaches get you to the same destination with very little difference.
  5. You have to put the name of your database in mysqli_select_db(). But you don't even need to call mysqli_select_db() because the database was already selected when calling mysqli_connect()
  6. No, HTML cannot do that. Features like this are done through server-side languages, often with pre-built content management systems.
  7. You can't make it go away, because CSS actually needs to block rendering. You can make it less of a problem by reducing the number of HTTP requests necessary to load stylesheets. Mainly, don't have more than one stylesheet on your page.
  8. In that case I'd need to see your XSL stylesheet to be sure. What does the resulting XHTML look like after the XML has been transformed? The only important part is that the necessary information is available in the resulting XHTML.
  9. Generally I just let the CSS cascade and override anything that needs to be changed, but there isn't a problem if you want to add a media query to exclude some of the styles on different screen sizes.
  10. Javascript is restricted to only loading data from the domain name it is running on. If the other site sends a header specifically indicating that cross domain requests are allowed then you can load the content from the other domain. To guarantee it will work for any domain you will have to use PHP's curl library.
  11. This does not look like XHTML. Tags like <ref> and <note> don't do anything unless the reader is programmed to do something with them, which an ordinary browser won't. If your document is being interpreted by some other program other than a browser then you will have to tell me what it is. To do the behavior you're expecting in a browser you need to write Javascript to do it.
  12. I would advise against using @import anywhere except between <style> tags. Otherwise the page has to do extra requests before displaying the page to the user. @import allows stylesheets to include other stylesheets. It works just the same as the <link> tag.
  13. It seems this class does not do anything if used on an <ol> element. I would have expected the same behavior. I guess W3.CSS is not very well designed. Hopefully they'll fix this in a future version.
  14. I can't tell you a workaround for this unless you can tell me specifically what you need it for.
  15. $_POST has to be written all in capital letters. These variables will not contain anything: $name = $_post["name"]; $visitor_email = $_post["visitor_email"]; $times = $_post["times"]; $message = $_post["message"];
  16. I don't think there's a way to run line by line, but add as many break points as you need. Your solution worked, but all you really needed to do was to move these lines var canvas = document.getElementById("canvas"); var game = new Game(canvas); to the beginning of setup(). I gave you that advice assuming you were using the same code I originally sent to you. You've started adding new functions and global variables. Here is the full setup function: window.addEventListener("load", setup, false); function setup() { /* Initialize the game object */ var canvas = document.getElementById("canvas"); var game = new Game(canvas); // Sounds game.sounds.splat = new Audio("sounds/CowMooSplat.mp3"); game.sounds.goodbye = new Audio("sounds/GoodBye-Female.mp3"); game.sounds.cheering = new Audio("sounds/cheeringCrowd.mp3"); game.sounds.oops = new Audio("sounds/oops.mp3"); // Sprites game.sprites.background = document.getElementById("bgCompound"); game.sprites.manufacturer = document.getElementById("manufacturer"); game.sprites.cowpie = document.getElementById("cowpie"); // Scores game.scores.totalScore = document.getElementById("totalScore"); game.scores.oops = document.getElementById("oopsScore"); game.scores.hits = document.getElementById("goodHits"); game.scores.totalShots = document.getElementById("totalShots"); // Create thrower var throwerSprite = document.getElementById("thrower"); var throwerX = canvas.width / 2; // Center of the canvas var throwerY = canvas.height - throwerSprite.height; // Bottom of the canvas var thrower = new Thrower(throwerSprite, throwerX, throwerY); thrower.speed = 120 / 1000; // 120 pixels per second thrower.cowpieSpeed = 180 / 1000; // 180 pixels per second game.setThrower(thrower); // Create targets var hillarytrue = document.getElementById("tru02"); var hillarylies = document.getElementById("lie02"); var target1 = new Target(hillarylies, hillarytrue, 128, 24); target1.speed = 120 / 1000; // 120 pixels per second var target2 = new Target(hillarylies, hillarytrue, 0, 68); target2.speed = 120 / 1000; // 120 pixels per second game.addTarget(target1); game.addTarget(target2); /* Set event handlers */ // Pause/Resume document.getElementById("pause").addEventListener("click", game.pause, false); document.getElementById("play").addEventListener("click", game.resume, false); // Actions document.getElementById("left").addEventListener("mousedown", thrower.pressLeft, false); document.getElementById("left").addEventListener("mouseup", thrower.releaseLeft, false); document.getElementById("right").addEventListener("mousedown", thrower.pressRight, false); document.getElementById("right").addEventListener("mouseup", thrower.releaseRight, false); document.getElementById("throw").addEventListener("click", thrower.throwCowpie, false); document.addEventListener("keydown", keyPressed, false); document.addEventListener("keyup", keyReleased, false); var canFire = true; function keyPressed(e) { switch(e.keyCode) { case 39: case 68: // Right arrow and D thrower.pressRight(); break; case 37: case 65: // Left arrow and A thrower.pressLeft(); break; case 38: case 87: // Up arrow and W if(canFire) { canFire = false; thrower.throwCowpie(); } break; } } function keyReleased(e) { switch(e.keyCode) { case 39: case 68: // Right arrow and D thrower.releaseRight(); break; case 37: case 65: // Left arrow and A thrower.releaseLeft(); break; case 38: case 87: // Up arrow and W canFire = true; break; } } /* Begin the game */ //// This is the only line that needs to be changed //// Remove the following: // window.addEventListener("load", game.start, false); //// And replace it with the following game.start(); }
  17. It's not simple. One method of doing it is described here: http://stackoverflow.com/questions/17083580/i-want-to-do-animation-of-an-object-along-a-particular-path
  18. If I were writing the parser I would look at the EBNF descriptions on the specification page I linked you to. I think the rules do not allow "xml" as a name for a processing instruction or element name.
  19. The validator on W3Schools is actually making use of your browser's own built-in XML parser, so it's not W3Schools' fault if the parser lets something past, but this isn't actually an error. The structure you represented (<?xmlstu12345 version="1.0" encoding="UTF-8"?>) is called a processing instruction. It's described in this part of the specification: https://www.w3.org/TR/REC-xml/#dt-pi Any structure with the format <?something ... ?> is a processing instruction. Some XML parsers will complain about the missing <?xml ?> declaration, but others accept XML documents that don't have one even though it's required by the specification.
  20. Your code was not foreign to me, just very messy and inefficient, it takes a long time to figure out the intention behind it. My code is structured according to common theoretical programming models and data structures. You probably should take some college courses because the theory is probably much more than what can be taught in a forum post. This is altered from the original game file I gave you and not from the code you have now. It will make sure that the game actually runs properly because it won't do anything until the images have loaded: /***********/ /** Logic **/ /***********/ // This event listener makes sure nothing runs until everything is ready window.addEventListener("load", setup, false); function setup() { // All the rest of the code goes here, unaltered /* Begin the game */ //// This is the only line that needs to be changed //// Remove the following: // window.addEventListener("load", game.start, false); //// And replace it with the following game.start(); } /*************/ /** Objects **/ /*************/ I can't tell you how to write the reset() method because I don't know what you want the game to do when that button is clicked. The only thing that has changed since the game started are the numbers in the score counters. Is there anything else you want to reset?
  21. Goodness, please stop posting hundreds of lines of code, my computer's going to short circuit from too much scrolling. Post the 10 or 15 lines that are relevant to the question you're asking. Describe clearly what you want to happen and show us what solution you have attempted. I'm not entirely sure what you were asking. You seemed to be talking about these lines of code: var target1 = new Target(hillarylies, hillarytrue, 128, 24); target1.speed = 120 / 1000; // 120 pixels per second var target2 = new Target(hillarylies, hillarytrue, 0, 68); target2.speed = 120 / 1000; // 120 pixels per second This creates two targets. Each target has the following parameters: Lies image True image Starting X coordinate Starting Y coordinate
  22. It might look better if your post wasn't formatted like an advertisement. At first glance it looked like something a spam robot would write. There are other icon stylesheets, there can't be a tutorial for every single product out there. Most of them have their own tutorials on their own website.
  23. This really isn't going to do anything: function resetSliding() { dots.click = function() { window.clearTimeout(timeHandler); timeHandler = window.setTimeout(showSlides,5000); } } It's adding a property named "click" to the nodelist and assigning a function to it and there's no point in your code where resetSliding() or dots.click() is called. You can learn how to properly set up events on this page: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events
×
×
  • Create New...