Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. I would assume Safari now gives the field a type of "date".
  2. In order to take full advantage of events you should be adding the event listeners using Javascript. Move your CSS to a stylesheet. Use margins instead of <br> elements for vertical spacing. <style> .copy-area { margin-bottom: 2em; } .copy-area textarea { border:1px solid black; resize:none; font-size:inherit; padding-top:1em; margin-left:3em; width:20em; height:2em; overflow-y:hidden; overflow-x:auto; font-family: verdana,tahoma,'Bitstream Vera Sans','DejaVu Sans',arial,helvetica,sans-serif; } .copy-area button { margin-left: 4em; } </style> <div class="copy-area"> <textarea readonly="readonly">sudo screen /dev/ttyUSB0 115200</textarea> <button>Copy text</button> </div> <div class="copy-area"> <textarea readonly="readonly">More code</textarea> <button>Copy text</button> </div> <div class="copy-area"> <textarea readonly="readonly">Different code</textarea> <button>Copy text</button> </div> <script> var textareas = document.querySelectorAll(".copy-area textarea"); var buttons = document.querySelectorAll(".copy-area button"); var i; for(i = 0; i < textareas.length; i++) { textareas[i].addEventListener("click", copyClipboard); } for(i = 0; i < buttons.length; i++) { buttons[i].addEventListener("click", copyClipboard); } function copyClipboard(e) { var elm = e.currentTarget; if(elm.nodeName.toLowerCase() == "button") { elm = elm.previousElementSibling; } // for Internet Explorer if(document.body.createTextRange) { var range = document.body.createTextRange(); range.moveToElementText(elm); range.select(); document.execCommand("Copy"); alert("IE Copied content to clipboard"); } else if(window.getSelection) { // other browsers var selection = window.getSelection(); var range = document.createRange(); range.selectNodeContents(elm); selection.removeAllRanges(); selection.addRange(range); document.execCommand("Copy"); alert("Copied content to clipboard"); } } </script> I'm not certain that the range code is working properly, that's another topic, but at least the event listeners are working properly.
  3. You should log currentTarget and see what value it contains. If the event listener is on the textarea then currentTarget should be the textarea. To log it, put console.log(event.currentTarget) in your code and then press F12 to open developer tools and see what it printed. Not all of your code is here, so I don't know which element has the event listener. If your event listener is not on the textarea, then you will have to use DOM traversal properties (parentNode, childNodes, nextElement, previousElement and several others) to get to the textarea from the element that you are clicking on.
  4. Ingolme

    SQl Statment help

    This is simple logic. You want to return a row if: Status is open Status is closed and a is 1 or b is 1 or c is 1 or d is 1 or e is 1 or f is 1. This translates to the following WHERE clause: WHERE status = 'open' OR status = 'closed' AND (a = 1 OR b = 1 OR c = 1 OR d = 1 OR e = 1 OR f = 1)
  5. The currentTarget is an element. It is the element which fired the event. You can use the currentTarget itself wherever you needed an element.
  6. That's a really complicated subject, it's not something you could teach in a short online tutorial. Just to begin you need a lot of prior math knowledge.
  7. There's also the problem that your code is using curly quotes instead of regular ones. You might need a different code editor.
  8. Is there anything preventing you from just putting those styles into a stylesheet? You can have some Javascript code loop through all textareas in the document and add an event listener for your onclick event.. You can even set the readonly property. var textareas = document.getElementsByTagName("textarea"); for(var i = 0; i < textareas.length; i++) { textareas[i].addEventListener("click", select, false); textareas[i].readonly = true; } function select() { e.currentTarget.select(); }
  9. Ingolme

    PHP question

    This looks like a homework question, we don't just do homework for people. It seems like they're asking you to design a database table and write the PHP code that will put the form data into the database. I would hope that you have some notes from your school describing how to do those things, but if not here are the relevant tutorial pages: Reading data from HTML forms: https://www.w3schools.com/php/php_forms.asp PHP database tutorial: https://www.w3schools.com/php/php_mysql_intro.asp SQL tutorial: https://www.w3schools.com/sql/default.asp
  10. Ingolme

    Variable Strings

    What does the error message say? Please wrap your code in a code block so that it is easier to read.
  11. You have to add the "w3-border" class along with "w3-border-red"
  12. Perhaps you meant to write $('#wm_container').width(),
  13. All whitespace inside the <pre> tag is rendered, including the line break at the beginning and end of the tag. If you want to remove those line breaks then you will have to put the code on the same line as the tag: <pre><span class="inner-pre" style="font-size: 16px">bind 'set disable-completion on' cat &lt;&lt;EOF&gt;&gt;/etc/aliases || exit 1 root: $admin_email EOF newaliases bind 'set disable-completion off'</span></pre>
  14. I'd assign the value returned by ->fetch() to a variable and print it out to see what it contains. You only need to call ->execute() once, the second one will probably cause an error.
  15. You can disable it in your own browser, but not for anybody else. Instructions for Chrome https://www.ghacks.net/2018/02/06/how-to-control-audio-and-video-autoplay-in-google-chrome/ Instructions for Firefox https://support.mozilla.org/en-US/kb/block-autoplay Read more about Chrome's autoplay behavior here: https://developers.google.com/web/updates/2017/09/autoplay-policy-changes It is a terrible user experience to autoplay sounds, this is why browsers disable it until the user actively chooses to see the media.
  16. I believe that most browsers today have a feature that does not allow autoplay videos to have sound. This is so that users don't get annoyed as soon as they land on a page.
  17. You can't. Make the whole thing a background image.
  18. This is not really a tech support forum, most of us just write code, so I'm not sure if you will find answers here.
  19. Ingolme

    php day array

    What is the code that uses the $weekdays array to draw the graph?
  20. The default is most likely "block" but I can't see your HTML so I can't be sure.
  21. Ingolme

    Bootstrap3

    They're just placeholder images, you're supposed to replace them with your own images. 150x80 tells the placehold.it site how large you want the placeholder image to be.
  22. You will have to specify a negative z-index to keep it behind all of the elements. By default, it is in front of the elements that precede it and behind the elements that follow it.
  23. I have never heard of Elastic Search before.
  24. It would make sense to add some of those, but not without big warnings to indicate that they are not supported by all major browsers in use today. But some of these would just make the tutorial too confusing for somebody who is just beginning.
×
×
  • Create New...