Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. Ingolme

    Problem using PDO

    That sounds like the program is halting at the line where the query was executed. Make sure error messages are activated by putting this at the beginning of the script: ini_set('display_errors', 1);error_reporting(E_ALL); Could you show the most recent code you have?
  2. Third party software is really big and really complex. Figuring out the source of a bug in somebody else's software is not a trivial task.
  3. Ingolme

    @session_start

    At which point did you give $_SESSION['username'] a value?
  4. ems are discussed in the CSS tutorial page about fonts:http://www.w3schools.com/css/css_font.asp
  5. When the content isn't visible look at the generated source code to see if it's there or not. If it's not there then you'll know the problem is with the script on the server. If it is there then the problem is with how it's being displayed. Check to see if the resulting code is valid HTML: http://validator.w3.org/ Also check your CSS: http://jigsaw.w3.org/css-validator/ There are errors in your CSS and HTML that could be contributing to the problem. You should put all that CSS into an external stylesheet, it would really reduce the amount of code that needs to be downloaded each time the page loads.
  6. You've misspelled onreadystatechange as "onreadstateChange". Watch the syntax carefully. Javascript is case sensitive, event names are all in lowercase.
  7. Actually, it's an error 406 Not Acceptable. The 404 error was because a 406 error document was not found. It means that the server can't send a response of the type the client requested. I'm afraid you'll have to bring this to the support team of the software you're using.
  8. It's right in the manual: http://php.net/manual/en/mysqli-stmt.bind-param.php Scroll down to "types"
  9. The first question is: Why? The document does not take very long to load, if you were using the window's onload event then you would have to wait for all the images to load first, but document.ready just waits for the HTML to load before firing. There is no event prior to the ready state. If you want a script to run immediately after a particular element has loaded, put the script tags the first thing inside that element or if it's an empty element, put the script tags immediately after it. If your script is in the <head> and does not have any event handlers, it will run immediately, but be warned that that script will not have access to any elements on the page because they have not yet loaded.
  10. This sounds complicated. To begin with, a basic solution could be to change the scrollTop of the box containing the text based on ratio of how much was played and how much is left to play. There's a problem with this: You can't be certain that the words in the audio are evenly distributed throughout the file. Perhaps at some point he's talking faster than at other points. I think many audio formats allow embedded subtitles, I haven't investigated much in that field but it's something I would do if this were the task assigned to me. Something I certainly would have to investigate is the <audio> element's API to figure out how much is played and how long the file is. A search for "MDN Audio API" will probably find something. I like the MDN (Mozilla Developer Network) because they have very good documentation for Javascript features. What you might need to is load data from a file that associates particular times in the audio file with particular written sentences. Each time one of these time intervals is reached the scrollTop property of the box containing the text is updated with the new position. I know that scrollTop can be changed in most browser, but it probably is better to use the .scrollTo() method instead.
  11. Don't rely on your developer software to catch errors. Create your code, run it in a browser and check for errors on the browser. Browsers are constantly changing, no developer environments will be able to keep up with these changes.
  12. Ingolme

    Contact form

    Check to see if the mail was successfully sent: $success = mail( ... );if($success) { // Show success message} else { // Show failure message}
  13. You can set the image's vertical-align to "middle" to prevent the extra space from appearing below it. If you want the icon to be at the bottom of the div then you will need to set that div's position to "relative" and use an absolute position on the icon. Give your <a> element a class or ID, for example id="icon" #top_box { position: relative; }#icon { position: absolute; bottom: 5px; right: 5px;}
  14. The only way to get better is to keep on practicing. Start with the basics and do it over and over until it sticks. Use online references to make sure that your syntax is correct.
  15. Ingolme

    lightbox

    You'll need to learn about Javascript animation in general, some math knowledge is required as well. This tutorial is a good place to start: http://javascript.info/tutorial/animation
  16. Ingolme

    lightbox

    Yes, knowing Javascript is important, but you're not going to find tutorials on how to make a light box because it's such a particular thing and it's pretty complex. Tutorials give you basic building blocks. They can teach you about each of the different components that things are made up of, but they won't tell you how to put those components together because there are endless ways to do that. The main skill every programmer needs is knowing how to use the tools they have to make what they want. These are some of the things you need to know to make a lightbox from scratch: A lightbox is an element on the page, usually a <div>, with position: absolute and a specified width and height. It is hidden until it is needed. It has a background color and sometimes a border. You can create elements using document.createElement() and add them to the page using appendChild(). Inside the lightbox is an <img> element that is set to the same URL as the href attribute of a link that was clicked on. To target the links on the page, or any other element, you can use DOM methods such as getElementsByTagName() or getElementById(), and DOM properties such as parentNode and childNodes. The box changes its size to fit the image it contains. To find out the size of the image, check the image's width and height properties after it has loaded, you need to use the image's onload event to determine that. To change the style of the box, use the style property. This isn't all that you need to know, there's also event handling, animation and more basic things such as callbacks. Each of these things take time to learn on their own, trying to cram it all into a single tutorial is impossible.
  17. Ingolme

    Problem using PDO

    $query->errorInfo() has to output something. At the very least it should output an error code zero, meaning that everything is working fine.
  18. Read about data types: http://www.w3schools.com/js/js_datatypes.asp Things wrapped in quotation marks are strings, if you want that particular text to be used then wrap it in quotation marks. If you intend to use variables, functions, arrays or objects then you shouldn't wrap it in quotation marks.
  19. Ingolme

    Contact form

    That error does not match the code you're showing. There's no PHP on line 1. There is an error on this line: <?PHP//Then outside the processing script add If (isset($_GET['thankyou'])){echo "Thank you for your email!<br/><br/>";}?> PHP is case sensitive, "If" is different than "if". The letters "PHP" should be lowercase as well.
  20. Ingolme

    lightbox

    Almost all lightbox scripts are built upon jQuery because it simplifies DOM access and animation. I have never searched for a Javascript-based one. Why are you opposed to using jQuery?
  21. I don't really understand your question. Can you link to a website that has the navigation the way you want it to be?
  22. Ingolme

    Contact form

    Are you getting any error messages? If not, then there is another procedure you must follow. The mail() function returns a boolean value that tells you whether the mail was accepted for delivery or not, check whether it is true or false before showing a success message: $success = mail( ... );if($success) { // Show success message} else { // Show failure message} Are you testing this from your own home machine? Most testing server software does not come with a mail server installed, so you'll need to test in a real server environment to make sure your mailing form works. Unrelated to the problem, I recommend you put all your form handling logic at the very start of the page before the <!DOCTYPE> declaration. If there's anything that needs to be printed onto the page, just store it in a variable and print the variable wherever it needs to be on the page. Headers should be sent before any of the content of the page, but from my experience this year it seems newer versions of PHP have been prepared to handle late headers without any error messages.
  23. If a function does not return anything and you assign it to a variable, the variable will have undefined as its value. No errors or warnings. function doNothing() { // Nothing}var x = doNothing();console.log(x); // Shows "undefined" Your Javascript functions are only available on the page they were created, other browser tabs can't access any of your code and there is no interference of any kind. Each tab or window is in its own closed environment. Just leave the setCookie() function global. Leave your function global, there is no problem with it. You would only need to worry about having things in the global scope if you're making a large application including scripts created by other people, then your global function may overwrite or be overwritten by a function or variable that somebody else created.
  24. Read up on how functions work: http://www.w3schools.com/js/js_functions.asp You only need to assign the function to a variable if the function gives you a value that you want to use later. getCookie, for example, will give you the value of the cookie, so that's why you assign it to a variable.
×
×
  • Create New...