Jump to content

Ingolme

Moderator
  • Posts

    14,897
  • Joined

  • Last visited

  • Days Won

    176

Everything posted by Ingolme

  1. You're relying too much on relative positioning.When you use "position: relative" the space that was occupied by the element continues to be occupied even after the element has moved. You also shouldn't need to set the height on most elements. The height of an element is automatically calculated based on the content within it.
  2. I can't think of a project that doesn't use conditionals and loops.
  3. var 1="apple"; 1 is a number, not a variable name. if (y=1) This line sets y to 1, if you read the tutorial page about if() you will see that == is used to compare, rather than the assignment operator, =. document.write(x); When used in this way, document.write() will erase all the content of the page and then write the new content. There are other ways to get information onto the page, like setting the text that's inside an HTML element.
  4. mysql_real_escape_string works. If you're getting more backslashes than you should then your server probably has magic quotes activated. To make sure this doesn't happen, you can detect if magic quotes is enabled and then remove the slashes before applying mysql_real_escape_string: if(get_magic_quotes_gpc()) { stripslashes($data);}mysql_real_escape_string($data);
  5. OK. The first step you need to take is to actually learn Javascript. Copying code from different places without knowing how it works is going to lead to failure. W3Schools has a good Javascript tutorial to begin. To learn about event handling, visit the links from my previous post. You should also read W3Schools' HTML DOM tutorial.
  6. There's a lot more than what I showed in my script. It's not going to work on its own. There are two variables in my code that I assumed were already set: element and e. The e variable is a result of Javascript's event handling. Explanation as to where it comes from and how to set it is here: http://www.quirksmod...nts_access.html You need to use DOM methods to make a reference to the <input> element, which should be stored in the element variable. You can also use the event object to find the element as shown here: http://www.quirksmode.org/js/events_properties.html#target I also assumed a keycode property, but it isn't a cross-browser solution, you can read about finding out which key was pressed here: http://www.quirksmod...erties.html#key
  7. Giving a min-width to the <body> element or the wrapper will prevent the page from messing up on smaller screens.
  8. I believe you're looking for the background-size property. It's not supported in older browsers, though. The alternative is to use an <img> element with absolute position, 100% width and a negative z-index.
  9. Outside of PHP you need to have another application that sends mail. The sendmail path is supposed to tell PHP where it is.
  10. To hide the scrollbars, easy: CSS overflow: hidden.To scroll the page, you have to determine what is going to trigger the scrolling like buttons or key events, then use the scrollTo() or scrollBy() methods to scroll the page.
  11. In pure Javascript it's easy. But your list of words isn't exactly hidden. People can find it if they want to. First you have an onkeyup event handler. When the keyup event is fired you check that the keycode is 13. if(e.keycode == 13)If that's the case, just loop through a global array of keywords to see if any of them matches the value of the input field: var match = false;for(var i = 0; i < keywords.length; i++) { // The variable "element" is a reference to the text input if(element.value == keywords[i]) { match = true; break; }}if(match) { alert("Correct keyword");} else { alert("This is not a keyword");}
  12. Those are conditional comments created by Microsoft in order to make up for such a bad browser.
  13. You can hide the scrollbar, but then you're going to need Javascript to scroll the page.
  14. Ingolme

    Cookie path.

    I'm not sure what a cookie has to do with a path. You read the value of a cookie using the $_COOKIE[] superglobal.For example: echo $_COOKIE['data'];
  15. Just select the table and set the background-image property: table { background-image: url(file.jpg);}
  16. It sounds like you want to replicate the functionality of the placeholder attribute. You seem to have described the functions in your post already. The only problem is that you won't be able to use values with spaces in them as IDs. // Onfocus handler:function clearField(e) { e = e ? e : window.event; var el = e.target ? e.target : e.srcElement; if(el.value == el.id) { el.value = ""; }}// Onblur handler:function defaultText(e) { e = e ? e : window.event; var el = e.target ? e.target : e.srcElement; if(el.value == "") { el.value = el.id; }}
  17. If they both have the same namespace then there's no way to distinguish them. You need another namespace if you want the elements to be different.
  18. It wouldn't give a syntax error, the syntax is perfectly fine. It would throw an error because the method does not exist.
  19. Put each tag and X together within an inline element, like <span> and set the white-space property to "nowrap" <span class="together">Tag1 <img alt="X"></span> <span class="together">Tag2 <img alt="X"></span> <span class="together">Tag3 <img alt="X"></span> .together { white-space: nowrap;}
  20. The regular expression is missing delimiters.Try this:$y= preg_replace("/[^0-9]/", "", $x);
  21. You should be passing a string to the $() function.$("ul li")
  22. json_encode() is the best option. The reason your first script isn't working is because $table is a two-dimensional array and therefore requires two nested loops to read values from it.
  23. No, XML can't actually do anything. It's not a programming language, it's just a format to store data. It's about as active as a plain text file.If you want to make the computer do something you'll have to learn C++, Java or some other programming language.
×
×
  • Create New...