Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. The AJAX has to be on the same server as the PHP file, and in the case you're running it from your computer, you have to access it with an http: address.
  2. The Javascript does have to be executed from its http://localhost/ address in order to call the files.
  3. That doesn't make sense. I can't imagine any situation in which this could happen. Wherever the problem is, it's not with the Javascript. Are you testing this in a proper server environment?
  4. The <body> probably has default padding. Use CSS to set it to 0. html, body { margin: 0; padding: 0;}
  5. This line is deleting absolutely everything that's in the <body> element before adding something new: document.body.innerHTML = data; Another problem I find is that you're (probably) loading an entire HTML document with <!DOCTYPE>, <html>, <head> and <body> tags inside your <body> element, which is a malformed DOM structure. I cannot predict what the browser would do while trying to render it.
  6. Removing the codebase attribute should work.
  7. A doctype is required. Add it, and then go fixing the page with the CSS.
  8. A flash player works, it's a good solution. The <video> tag goes playing the video as it's loading as well, but you have to see which browsers support which video format and have multiple copies of the video on your server.
  9. You need to add an event listener to the document that will listen for keystrokes. I heard safari only accepts keyboard input when a form input is selected, but I'm not sure. For other browsers: document.body.onkeyup = function() { // Check which key was pressed and call the right function for it} More information about keyboard events here: http://www.quirksmod...erties.html#key Your program might be a little more complicated. You probably need to keep a reference to the element you're currently looking at in a variable, and use the DOM to navigate to the next or previous siblings. It's not something I could do in 5 minutes, I'd need a little longer to figure out the whole thing.
  10. To display HTML, change all < to <, change all > to >.Javascript code should display just fine without any alterations, and the same with CSS. Any < or > symbols are best converted to < and > respectively. Example:Use the <style> tag to add CSS to your website
  11. It seems I misunderstood your question. I think I know what you want now. The problem is a result of using the LIKE operator. Instead of (`rollno` LIKE '%".$query."%')" use `rollno` = $query
  12. Your current website is trying to use innerText rather than innerHTML
  13. OK, to debug this, you'll have to go to this part of the code and see if it's working properly: if(data == 'yes'){ newDiv('isAcceptingNewWork','greenBanner'); // Check that this element is accessible alert(document.getElementById('isAcceptingNewWork')); document.getElementById('isAcceptingNewWork').innerHTML = "We are currently accepting new work. Feel free to contact us for a consultation!"; // Check that the innerHTML was set alert(document.getElementById('isAcceptingNewWork').innerHTML);
  14. The file has to have a .php extension. Rename it to index.php
  15. I just showed you in my previous post. Put this in each of your pages: <?php include('footer.php'); ?> Assuming the contents if your footer is in a file called "footer.php"
  16. The problem with attempting a workaround with Javascript is that your site isn't going to work for people who navigate with Javascript disabled. It's also invisible to search engines and it slows down the loading of your page. If your server supports PHP, just put this in every page: <?php include('footer.php'); ?> If you want to test first on your computer, you can download WAMP to test your PHP pages.
  17. If you want the page to refresh, why use AJAX? If you remove the Javascript the form will submit loading another page. You might have to change the PHP script so that it redirects back when it's done.
  18. HTML can't do it, but if you learn some server-side scripting you can get it done. PHP is the most popular one, you can learn it here: http://w3schools.com/php/ Normally, rather than putting the footer into every page, in PHP you'll have one page template and put the content into it based on the URL. PHP uses the include() directive for that.
  19. Well, it seems to be fine, generally. When the login fails, this line takes care of that: else {header("Location: ". $MM_redirectLoginFailed );} Be sure to put an exit; statement right after sending the header so that if there are delays the page won't show the rest of the content. There's more than one way to show a message upon failure. The "login failed" page you're redirecting to could be an HTML page with the message in it and a timed meta redirect. <meta http-equiv="refresh" content="5;login.php">
  20. Well, aside from the error that was pointed out previously, there might also be a problem if firstChild() refers to a text node in this line: document.getElementById('content').firstChild To be sure that the newDiv() function is working, check that document.getElementById('isAcceptingNewWork') actually exists. If the element failed to be appended to the document then getElementById() cannot reference it. Another problem is probably here: $.get("lib/php/isAcceptingNewWork.php") .done(function(data) { Putting a line break and all those spaces is probably going to consider .done to be a different line of code which is not associated to the previous one. Generally, in Javascript, a line break is equivalent to a semi-colon ( ; )
  21. OK, the problem is that Javascript is getting the data from an element with id "comment" var comment = $("#comment").val(); You're going to have to give each textarea (and all your inputs as well) its own unique ID, then have Javascript work differently for each form. IDs cannot be used more than once in a document. You can't have two or more elements with id="comment"
  22. The operating system doesn't matter, only the browser does. Does your HTML have a doctype declaration? I'd advise against absolute or relative positioning, it always gives trouble.
  23. XML doesn't have embedded content, it is just a data format. Is this XML or XHTML?
  24. Each comment area should have its own form tag so I don't see why it's giving data from a different form. Be sure that all your <form> elements are properly closed and in the right place. If you want to make sure the comment is added to the correct post add a hidden input to each form indicating the post it belongs to: <input type="hidden" value="<?php echo $post_number; ?>" name="post"> When you add data to the comments database table:$post = intval($_POST['post']); INSERT INTO comments (post, user, other data ...) VALUES ($post ... ... )
  25. In your SQL query you need to add "WHERE customer_id=1"
×
×
  • Create New...