Jump to content

jeffman

Members
  • Posts

    7,761
  • Joined

  • Last visited

Everything posted by jeffman

  1. 2. The only time you are allowed to not specify the unit is when it's 0. I think some developers figured this out years ago and used it as shorthand. It has the advantage of being instantly recognizable as 0 and not a 9 or something similar. But you have to remember to add the units if you ever change it. I think omitting the units is bad practice, but I confess that I do it. 1. Floating the div is necessary to correct an error later on. But it's a bad fix. Without it, the div does not expand vertically to enclose its content. That's because the <a> elements are floating. Floating the <a> elements is also necessary to fix an error, but it's a different fix. The author has defined the display property of the <a> elements as block. They should not be blocks. Blocks do not belong in inline elements. Since they are blocks, though, they are going to fall, even if the enclosing <li> elements are inline. To fix that, the author floated them. Now they line up. The correct style would be inline-block for both the <li> and the <a> elements. Now nothing needs to float. 3. As I said, the <a> elements are floating to correct for them being defined as blocks. But the <li> elements should be defined as inline or inline-block to make the menu horizontal. This correct. 4. The author made the <a> elements block level to force the containing <li> elements to respect the <a> elements' padding and expand vertically. As I said, this is all wrong-headed and can be solved by setting the <li> and <a> elements to display as inline-blocks. Is this really old CSS from days when all browsers did not support inline-block? We had all kinds of work-arounds back then. inline-block fixed a lot of problems. FWIW, it took a little experimentation to figure this out. I knew the CSS was wrong without trying it, but I'd forgotten why.
  2. In other words, don't start a thread that's off-topic, and don't hijack a thread to talk about politics or your family. OTOH, no one really objects to a joke now and then, especially when the question a thread is about has already been answered. The biggest problem with the thread you mentioned is that the comments got personal and nasty. There are other development forums where nasty is normal, but this is a friendly forum.
  3. They mean different things; which one is correct depends on your HTML. 1. targets a link with id="red"2. targets a link that is a descendent of some other element with id="red" In the example, #home a:hover targets a link that is a child of a <li> with id="home"
  4. jeffman

    Help for Uni Project

    Develop the sticky footer for one page. When you have it working, you should be able to include the HTML into any document, and link to the CSS also. Trying to develop the sticky footer WHILE you are learning to include things will make debugging more difficult.
  5. jeffman

    Need help with eval

    What are you really asking? Your function does NOTHING, and eval is not necessary. The logical operators you are using (&& and ||)are all you should need.
  6. jeffman

    Help for Uni Project

    Google sticky footer.
  7. PLEASE do not give incorrect advice. No external libraries are required to execute native PHP code. Some third-party libraries, like WordPress, often have a config file where the user sets basic settings. Some developers use a file named config.php to set up routine database connections. There is nothing in ali.aggressor's code that uses a database. Giving incorrect advice can confuse anyone who reads this thread, now or five years from now. Before you post, make sure you really do understand what you think you understand.
  8. You need to assign that to the innerHTML property of some element rather than the text content.
  9. Mere mortals cannot know everything about regular expressions. That skill belongs to the gods.
  10. jeffman

    2 forms

    I would develop the page with the code in the page. When I went into production, I would separate the code into an external script. 280 lines is really not a lot. Byte count is more important because that affects download time. Just as good practice, if there is anyway to avoid repeating code by writing smaller functions, do so. I mean, if 5+ lines of code are exactly the same in multiple places, you could split that off. Sometimes you can do that with code that is similar (not identical) by passing special arguments and possibly true/false switches.
  11. I see nothing wrong with your array. I do notice that you have a function called randomPlanet and that you try to access the length property of an undefined object called randomPlanet. Can't have both.
  12. The key word in your question is "look." You should know by now that means CSS. When you follow Ingolme's advice, look at the CSS that defines the appearance of a link you like. Save time by using the Inspect Element feature that most browsers have built-in today. I use that in Firefox a lot. When looking at your pages, your example.
  13. Try adding a name="submit" attribute to your submit button. I think your test for $_POST['submit'] is failing, and you have not added any way of printing a message when this happens. also I do not understand why index.php includes validation.php. Have you tried NOT including validation.php and submitting the form directly to validation.php instead of to index.php?
  14. You can get this information. It's as much information as an ethical developer should ever want. Since jQuery uses JavaScript, it has the same access to information and no more. The only time I ever see a real purpose for some of this information is when a vendor wants to speed up the process of selecting which version of a software product matches a user's system.
  15. The DOMDocument object does not support that syntax. The author of Simple HTML must have created that as a convenience.
  16. Your code is looking for an element with id="mod_form" ; your element has class="mod_form" ; add an id
  17. The following code works. And it does not require an external library. $url = 'http://www.someplace.com';$doc = new DOMDocument();$doc->loadHTMLFile($url);$els = $doc->getElementsByTagName('li');echo $els->item(0)->childNodes->item(0)->textContent; Notice: if your document really looks like this, PHP will issue a warning. The <pre> element is not permitted between <li> elements. <li id="pt12">Point 1.2</li> <pre class="CodeDisplay"> some codes </pre><li id="ref">Reference: <a href="link.html" target="_blank">link</a></li>
  18. The fieldset has to go in your form. AND the button.
  19. Here is a different kind of function. If I understand your needs, it should work. It requires a few changes to your HTML, which I show here: <fieldset id="field"> <input type="text" name="incident" /> <select name="sev"> <option value="none0"></option> <option value="###">###</option> <option value="###">###</option> <option value="###">###</option> <option value="###">###</option> <option value="###">###</option> </select> <select name="status"> <option value="###"></option> <option value="###">###</option> <option value="###">###</option> <option value="###">###</option> <option value="###">###</option> <option value="###">######</option> <option value="###">###</option> </select> <textarea rows="2" cols="30" name="description_tic"></textarea></fieldset><input type="button" value="Add" id="addButton" /> The four form controls that you want duplicated are inside a fieldset. The function below clones the fieldset and its contents. Then it changes the names of the new form controls so that when the form is submitted, your server script can tell which data is which. There is another way to change the names since you are using PHP. Ask me if you want. It might be better. window.onload = function () { document.getElementById("addButton").onclick = cloneFieldSet;}var counter = 0;function cloneFieldSet () { counter++; var theField = document.getElementById("field"); var theClone = theField.cloneNode(true); var elements = theClone.elements; for (var el in elements) { elements[el].name += counter.toString(); } theClone.id += counter.toString(); theField.form.insertBefore(theClone, this);}
  20. btn.id="select00";//////var currentSel = document.getElementById(btn.id); If you use the same id every time you create the element, the options will always be appended to the same element.
  21. Oops. You're right. Test for a certain array element, like isset($_POST['host']); FWIW, it's bad practice to ignore errors. Get in the habit of testing for stuff and working around it.
  22. jeffman

    javascript

    Also important, you never call the validate function. It has to be called from within reply_click. As it is, all that code does nothing. I don't see why you need the internal function anyway, if that's where most of the code is going to be. BTW, your users are going to hate you for making them sit through a potentially long string of alerts. Changing the innerHTML of a label next to the invalid item, or causing a red dot to appear next to the invalid item, is much more user friendly.
  23. Do you need to be evaluating the post data when the doc first loads? Do you, for example, need to test isset($_POST) and skip a bunch of code if that returns false? EDIT. Forgot to add, it no longer sounds like the form is the issue.
  24. Check your data like this: var_dump($_POST); Just put that at the top of your script and exit. Don't do anything else. If there really is no data there, something's wrong with your HTML document. Show us your form.
×
×
  • Create New...