Jump to content

Funce

Moderator
  • Posts

    602
  • Joined

  • Last visited

  • Days Won

    19

Everything posted by Funce

  1. Hi there, If you could please add your code using the forum code block feature, it will let other members help you easier. The setting can be found as below.
  2. So right here's you're two tasks you need to do as you've stated (just to get my head around it) Show and hide test_2 when test_1 is checked and unchecked respectively. When test_1 is not checked, you want to pass test_2 as NULL You seem to be using PHP so that makes it simple for me. Your first issue is that you aren't calling your Javascript code. You're defining it as a function, but not calling it. It isn't running. Add an onclick attribute to your test_1 checkboxes to get that JavaScript to run. You'll need to modify it as you've removed the div ids, but you seem to have that under control. The second part is a joint issue between your HTML and your PHP. You'll need to add some value attributes to your checkboxes, so some values are sent through on a form submission. Then inside your PHP you'll just have a bit of logic: if test_1 value is not set (unchecked checkboxes do not send a value) set test_1 to no set test_2 to NULL else set test_1 to test_1 value if test_2 value is not set set test_2 to no else set test_2 to test_2 value Save test_1 and test_2 into database Let me know if any of this is unclear.
  3. Well that would be because your alert code is inside your Focus function and not your Blur function. So the alert is executing (after you've focused), then when you close the alert it refocuses which causes the alert again.
  4. Your validateForm function only checks input elements as it currently stands. As a textarea element is not an input element, you'll need to add some additional code to the validateForm function. You might be able to get some solid use out of element.querySelectorAll() in this case. Something close to x = document.getElementsByClassName("tab"); y = x[currentTab].querySelectorAll("input"); If you modify what's inside the brackets of querySelectorAll, you may be able to use it get your input, textarea, and select elements. Works just like a CSS selector. Speaking of CSS, you'll also need to add an 'invalid' style for the textarea and select elements. Otherwise, it won't turn red like the others. You could copy the invalid style from the input.
  5. I would recommend utilizing something like overflow-y in your code. Set your body to the height of the screen, and set the overflow-y to hidden. That will eliminate the scrolling behaviour.
  6. Funce

    If Else

    You would be correct. Ternaries can perform multiple statements of execution. I'll point out that you're still executing one statement by nesting ternaries but the ability is there. However to use ternaries to execute multiple statements, would be... not ideal. Why would you not use an if...else? Additionally nesting ternaries exponentially reduces readability past the first.
  7. Interesting observation, thanks for clarifying my test cases. These ISO XSD-schemes are usually quite good for validating malformed data. And to enforce a consistent format of data exchange (which is the entire point of xml) You'd be correct that any further validation of what sort of data you want allowed would need to be internal. (Unless you included some bounds of the date that you'd allow, but I'm not sure on the specifics of this one)
  8. I would recommend adding the code that makes what's inside the pictures.
  9. I haven't used Python as a web backend before, so I'm not exactly the best person to consult on that. So why are you considering this feature? I don't think that its a feature that will be actively noticed from user to user. What's the plan?
  10. Click the triangle to start the spinning! (In this example) Rotation going... right?? Do you mean clockwise? Well uh, have at it then <style> @keyframes rotation { from { transform: rotate(0deg); } to { transform: rotate(359deg); } } #triangle-up { width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-bottom: 100px solid red; animation: rotation 0.5s infinite linear; } </style> <div id="triangle-up"></div>
  11. To add any additional validation code would dilute the example being taught here, which is the use of HTML attributes as validation. Ideally you want the various validation methods to be separate when learning, so you can understand the effects of each method of validation.
  12. What browser are you attempting to use for this? Fullscreen=yes is only supported in Internet Explorer.
  13. This is a speculative post based on my observations. It looks like rather than being constrained by any number of characters, it looks like the date format just instead needs to be delimited as allowed in the format. The letter examples seem to be merely common representations of how it is outputted. In terms of what CC means, I believe it might be referring to the century, rather than the standard year. I suspect that this might also be valid as a DateTime 1-1-1T1:1:1.1 and conversely 999999999-12-31T23:59:59.999999999999 See if you can check the above also. I'd be interested to see if there's a limit. I imagine if there isn't an arbitrary limit, the only limiting factor would be the max length of a string that is allowed to be put in.
  14. I'm not able to reproduce this, the code looks fine. Can you test this code on its own? <style> a[href^="mailto"]:link:before { content: " < "; } a[href^="mailto"]:link:after { content: " > "; } </style> <a href="mailto:xxxxx@hotmail.com">xxxxx@hotmail.com</a>
  15. The simple answer is no. You won't be able to win this one with only HTML. You'd definitely need a server side language to track what timestamp the audio is at. Minimum. I haven't played too much with media streaming so I wouldn't be able help tackle that challenge.
  16. You can always override styles by adding either a style element or in line. If you'd like to play with some styles, in-file styling is always a good way to do so. You can see the CSS tutorial to see about which CSS style methods override others. If you wish to find out what styles are being applied to a given element, you can always use the browser element inspector. Most browsers will allow you to right click and "inspect element" and allow you to view the styles that are being applied. They also allow you to change those styles live in the browser for preview and tweaks of distances for margins and the like.
  17. You may want to re copy your code using the forum code block feature. Your [ i ] in your code has been eaten by the formatter.
  18. Funce

    icon var

    The HTML code doesn't seem complete. Where is the Header and Title parts of the page in your HTML? What classes are applied to them?
  19. Just so you know, the LIMIT keyword indicates the number of rows to output. In this case, it is including Row 0 (first row) up to (but not including) Row 25 (26th row). Its quite common for it to be added to SQL browsers such as phpmyadmin and others. Just so if you have 70k rows (like I work with) you don't kill your program trying to look at all of them.
  20. Is this the layout of your files? [THIS_DIR] [THIS_PAGE] content.html (first example) folder content.html (second example) folder content.html (third example)
  21. You'd need to use some programming for this one. A backend language like PHP or ASP would be optimal, but a frontend language like JavaScript could work for it. You would need to find out what the date is, then compare it against the dates you want. Then either show or hide accordingly.
  22. The code in the fiddle seems to work fine, what are you expecting?
  23. ^[61][0-9]*$ [61] matches either 6 OR 1 at the beginning. You may want to double check some of your regex. If you want to avoid having something start with +61 then you can just do this ^\+61
  24. This tutorial illustrates both try and catch statements. The purpose of that line is to output the specific error that has been thrown in the try statement. "error detected" can mean anything between undefined variable to a syntax error. err.message will take the error message that would otherwise normally be put in the console, and put it into the demo <p> element.
  25. Hey there ASPete, If you want full downloads of the code check out this webpage and use the "try it yourself" buttons on the theme you wish to download. You'll find the entire source ready for copying into your own environment. You'll just need to make sure that you replace any images (and other local resources) with your own in the corresponding folder.
×
×
  • Create New...