Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. How about this? echo json_encode($row); That's it, just pass the array itself. No string concatenation or anything. The $row variable you're getting is an array.
  2. I assume definition_data.COM1_A is the variable with the number you want. You can just change the line to C1A.innerHTML = definition_data.COM1_A.toFixed(3); If that doesn't work, then it's because it's not a number and you'll have to cast it to a number first: C1A.innerHTML = Number(definition_data.COM1_A).toFixed(3);
  3. I went and removed the extra part you added in the code. (if you want to point something out in your code, use comments // or /* */) The problem is that you have forgotten to close the previous addEventListener() function that started on line 213.
  4. First, check your Javascript console for error messages. For security reasons, requesting files from other domain names is not permitted.
  5. The error was done deliberately to test the program. It does seem like the $stmt->errno part is working properly.
  6. On your description page you have a function that loads a description. Let's call it loadDescription(id) That function should put content in the description box based on what value you passed to it. You can add a hash to the URL in a link: www.siddhicenter.org/Inner/Space/Descriptions.htm#something When the page loads, you can tell Javascript to read the value of the hash and if it has the right value then you can call loadDescription() This example uses switch(). switch(location.hash) {case "#something": loadDescription(0); break;case "#something-else": loadDescription(1); break;}
  7. You can't print anything before sending a header because in an HTTP request headers must always get sent before the content. If you send a location header, the user's not going to see what you printed anyways because the browser would immediately jump to the next page. To get around this you can make Javascript perform the redirect instead of sending a header.
  8. Without the .php extension PHP won't run, at all. No matter how little or how much there is.
  9. Are you asking if you can just put Javascript code in the query string of a URL? http://www.example.com?function(param1, param2) { alert(param1 + " " + param2); } You can put anything in a query string if you encode it (substituting spaces for %20 and other invalid characters with their character codes). You can have Javascript read the query string and execute code using eval(). It's possible, but it's really really bad. You need to get to the underlying reason you want a system like this. Let's pretend you don't know anything about programming, you're just a user that's visiting a website. What do you want to see on the website? Show an example of another website that does what you want.
  10. Ingolme

    Select option

    I don't fully understand your question. You can read about the <select> element and all its attributes here: http://www.w3schools.com/tags/tag_select.asp
  11. The reason you're getting that error is probably because you're calling $stmt->close() inside the loop. I didn't notice that at first, you can take it out of the loop. The reason why I'm concerned with the error message is that PHP shouldn't necessarily show a verbal error message when the statement fails, you should just detect the error by looking at the statement's error code. What's the point in testing ($stmt->errno != 0) if PHP throws an error anyways?
  12. You can't change the opacity of the background image. You can put the background image in the top right corner of the box that contains it by setting the background-position property.
  13. All you really need for the iframe solution is this: <audio><iframe src="page.html"></iframe> Then use CSS to hide the audio element and make the iframe take the full size of the window.
  14. What do you not like about the <iframe> solution?
  15. Ingolme

    click problem

    e.target will sometimes point to the deepest element in tree, it's considered the element that the event occurred on.
  16. Ingolme

    click problem

    e.target is already pointing to the element with class .bodky at least some of the time, so there is no element .bodky inside it. Perhaps e.currentTarget, if not, then check the className of e.target and choose e.target.parentNode instead if the class if bodky.
  17. When you set the backgroundImage property, the browser checks to see if this image is stored in the cache and will try to load it from there; if the image isn't cached then it will download the image from the server.
  18. If you create a new window with window.open() you can refer to it from the child window using window.opener. iframes can access parent windows using window.parent or window.top
  19. No, you can't. But you can pass parameters in the URL's query string that Javascript on the receiving page can read and choose to run a particular function. You can read values from location.search or location.hash on the receiving page.
  20. Return from the function when something fails, returning false or -1 is a good way to let the person who called the function know that it failed. -1 is probably better in this case because the person that's calling the function expects an integer. If you're getting a PHP error message, what does the message say? Unrelated to the topic: You have an efficiency problem on this line: foreach ($services as $value) {if ($stmt = $connection->prepare('INSERT into appoint_servi_chosen (app_ID,service_ID) VALUES( ?, ? )')) You only need to prepare a statement once, if you prepare the very same statement every time you want to use it you're missing out on one of its main advantages. Prepare it outside the loop, then execute it as often as you want to inside the loop, like this: if ($stmt = $connection->prepare('INSERT into appoint_servi_chosen (app_ID,service_ID) VALUES( ?, ? )')) { // If the statement was prepared properly, execute it as many times as needed foreach ($services as $value) { $stmt->bind_param('ii',$lastid,$value); $stmt->execute(); if($stmt->errno!==0) {printf("Error-execution failed appoint_servi_chosen table: %s.n", $stmt->error);} $stmt->close(); }} else { // Show an error printf("Error-prepare statement failed appoint_servi_chosen table: %s.n", $connection->error); // We can show the person that's calling the function that it failed by returning -1 instead of $lastid return -1;} Lastly, I'm not sure why this is wrapped in curly braces: {return $lastid;} Some languages let you create a local scope by wrapping code in curly braces, but PHP doesn't behave like that. In the best case, PHP ignores then, in the worst case it will consider it a syntax error. I don't know because I've never attempted this.
  21. I think Flash player doesn't like to be invisible. What you might be able to do is set its position to "absolute" and put it behind something by giving it a negative z-index property. Elements with absolute position don't reserve space on the page. Your page uses the HTML 5 <canvas> element, only modern browsers are capable of using it, browsers created approximately within the last three years.
  22. I can't see this rule in your stylesheet: .video { height: 0; } I have no idea what browser Garry's mod uses internally, if it has one at all.
  23. This means Blogger is using XML syntax for its HTML. You should set the attribute as controls="controls"
  24. The image (I assume you're referring to the shield on the top left corner) has an absolute position. Because of that, it's going to the exact pixel position on the page that you told it to. You can try changing the top and left properties to move it around to a better position, or you can remove the absolute positioning and use other techniques. The <br> tag in your source code is causing there to be space above your <h1> element, you would have a lot more control over that if you removed it and gave a top margin to the <h1> instead.
  25. I find that setting the height of class .video to zero makes the black line disappear.
×
×
  • Create New...