Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. You can use basename() to get the filename out of the path.
  2. It's just a background picture with some elements placed ontop of it using position: absolute The HTML structure would be something like this: <div class="map"> <div class="box" style="top: 200px; left: 300px;>City 1</div> <div class="box" style="top: 142px; left: 30px;>City 2</div> <div class="box" style="top: 280px; left: 120px;>City 2</div></div> With CSS: .map { position: relative; /* Elements inside will be positioned relative to the top right corner */ width: 800px; /* Width of background image */ height: 600px; /* Height of background image */ background-image: url(map.png); background-position: top left;}.box { width: 100px; height: 40px; background-image: url(speech-bubble.png); background-position: top left; position: absolute;}
  3. Ingolme

    Error in database

    The variables are only being set if $_POST['name'] is set. Since $_POST['name'] isn't set, there's an error when trying to use those variables.
  4. Just create one <audio> element for each sound that will be in the game. Keep a pointer to that audio element the whole time and simply call the play method when you need to. No need to create a new audio element to play a sound if another audio element already has it.
  5. I'm quite sure Chrome will work just fine. The <audio> and <video> elements, the way browsers have implented then, don't necessarily have to load fully.Some browsers may choose to load only part of a file and load the rest after the file has started playing. This is up to the browser's implementation. It's possible that Chrome only fires the "canplay" event when "canplaythrough" is ready, which means that you really don't have any problem at all.
  6. Ingolme

    PHP file upload

    The function end() expects a variable, not a function call. $f = explode(".", $_FILES["file"]["name"]);$extension = end($f);
  7. You can check for the canplaythrough event.
  8. Hmm, I guess that you do need a <div> inside it then. You probably will have to set the width and height of that <div> in px or some other fixed unit, though. <td> elements are dynamic in size, so there's no "100%" to be referenced from.
  9. Ingolme

    Center page

    Which part of the page isn't centered? #logo, for example, has position:fixed, so that would prevent it from being centered. I'm not sure what this is supposed to do: The second width rule overrides the first one. header{ background-color:#FFF; width:100%; width:600px; nav has "position:fixed;" as well so I can't predict how that's going to behave, but it most likely won't be centered in any way. Remove all your position:fixed declarations, and try to make your CSS rules coherent.
  10. I think setting the position on the <td> element itself to relative should be enough. I haven't done the test myself, though, but I can't see why it wouldn't work.
  11. There aren't any exclusion selectors. The most you can do is select all <p> elements inside #aaa and then override that style with the ones that have IDs: #aaa p { color: green;}#bbb, #ccc, #ddd { color: inherit;} Excluding #ccc: #aaa p { font-weight: bold;}#ccc { font-weight: normal;}
  12. In what code did that error occur? valueOf() is a method, not a property, so you have to call it using parentheses.
  13. The relation between PHP and HTML is that PHP writes the HTML as if it was making the page in a text editor. Getting the data is one thing, but assuming you already have data in a variable, you can use it to print that HTML that you would put in the page if you were creating it yourself. // This data is actually provided by your API$data = array('total_players' => 153,'currently_online' => 152); // Just print the HTML and put the data where you need itecho '<div class="greenbox">';echo $data['currently_online'] . '/' . $data['currently_online'];echo '</div>'; /*Don't forget that the document has all the <html>, <body>, <link rel="stylesheet"> and all the rest.All that is omitted in this example to point out the important parts*/
  14. Set the margin of the <p> element to zero. You should learn CSS and avoid using formatting tags such as <b> and <center>
  15. PHP isn't the right language to do that. People make those interfaces with Javascript.
  16. Abstract classes allow you to add a default constructor, properties and methods to the object. An interface only forces an object to have a particular set of methods and it doesn't tell you how the method should be implemented. It's a semantic thing.
  17. Map out their truth tables: For the first one $a ^ $b A B Ouput0 0 00 1 11 0 11 1 0 For the second one: $a & ~$b A B Output0 0 00 1 01 0 11 1 0 The XOR operation is actually equivalent to $a & ~$b | ~$a & $b
  18. Ingolme

    SQL

    That depends on the structure of the table. I guess you could divide the annual salary by 12, assuming there's a field named "salary": SELECT (salary / 12) AS monthly_salary FROM emp
  19. Ingolme

    PHP Line Break

    If it's for an HTML document, use <br>, if it's for any other kind of data use n. Though perhaps you don't need a line break if it's for HTML and you can simply wrap strings in <p> tags.
  20. You have some deprecated things, such as session_register(). Here's how sessions are used in newer versions of PHP: http://us1.php.net/manual/en/session.examples.basic.php
  21. In this line Index.css has an uppercase i: <link type="text/css" rel="stylesheet" href="Index.css"/> Is the file index.css or Index.css?
  22. I wasn't aware indexOf was also an array method. I can't remember a case in Javascript when I needed to know if an array contained something. I can see why I never learnt it, though:
  23. Removing the #bodyPan part altogether would still work. Since IDs are unique, #mytablelinks can only possibly refer to one element regardless of what ancestor it has. Unless you have more elements with classname "pearl" that need to be styled differently, #mytablelinks isn't really necessary either. p.pearl on its own will select all the <p> elements with class="pearl".
  24. Loop through the array until you find the value you're looking for. You can build a function that does it for you function contains(arr, value) { for(var i = 0; i < arr.length; i++) { if(arr[i] == value) { return true; } } return false;}// Use the functionvar N = ["a", "b", "c"];if(contains(N, "c")) { alert("c is in the array");}
  25. The value that the user enters into the prompt is already assigned to answer in your code.
×
×
  • Create New...