Jump to content


Popular Content

Showing content with the highest reputation since 12/07/2018 in Posts

  1. 2 points
    I generally prefer to support the least common denominator to give the users of my website the best experience regardless of which browser they're using.
  2. 1 point
    $display= overwrites the prev output, you need to append to prev output with $display.=
  3. 1 point
    Sprites have limitations. For one, the container must be the same size in pixels as the sprite you're representing, otherwise other sprites on the same image are visible. Another limitation is that sprites cannot be repeating since background-repeat repeats the whole image file and not just a part of it. In short, you can't style a flexible box using sprites. On the other hand, you can use the border-image property in CSS to split an image into parts and use them to style a box.
  4. 1 point
    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.
  5. 1 point
    Browser cache, or if you use save login details in the browser itself usually setting->Privacy->Manage Logins. You can clear all these by making sure you select saved logins option (maybe under advanced) when clearing history.
  6. 1 point
    filter_var() with the FILTER_VALIDATE_INT filter returns an integer, not true, so === true will always fail. By using The ! operator, they transform it into a boolean. This boolean, for any integer other than zero, is always false. This solution doesn't account for the integer zero which converts to true, but W3Schools also has a section talking about that. They could just use !!filter_var() or (bool)filter_var() and they wouldn't need the === false part. This would still not solve the integer zero problem, though.
  7. 1 point
    You need to understand how the conditional works. In the statement X = C ? A : B , X is either equal to A or equal to B based on whether C is true or not. In other words: if(C) X=A else X=B
  8. 1 point
    Its always done that! Any floated element placed within a container element has no substance, so the container will collapse to height 0. Using property overflow reverses that condition for the container element.
  9. 1 point
    Ah , at last , it works: Ok Funce , I finally see what you meant . Thanks All . <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta charset="utf-8" /> <title>FreshDraft.StrippedDown></title> <style> @media print { .pageBreak{ page-break-after: always; } } </style> </head> <body id="bodyId" > <div> <br> <textarea class="copyFrom" spellcheck="false" rows="4" cols="12">textarea 1 line 1 textarea 1 line 2 </textarea> <br> <textarea class="copyFrom" spellcheck="false" rows="4" cols="12">textarea 2 line 1 textarea 2 line 2 </textarea> <br> <pre class="pageBreak">.</pre> <pre class="pageBreak">.</pre> </div> <br> <div> <br> <button id="printThisBtn" onclick="printAllThis()" style="display: block">Print This</button> </div> <script> var copyFrom = document.getElementsByClassName("copyFrom"); var pageBreak = document.getElementsByClassName("pageBreak"); var printThisBtn = document.querySelector("#printThisBtn"); function printAllThis() { collectedTextareas = ""; for (var i = 0; i < copyFrom.length; i++) { pageBreak[i].innerHTML = copyFrom[i].value ; } for (var i = 0; i < copyFrom.length; i++) { copyFrom[i].style.display = "none"; } printThisBtn.style.display = "none"; window.print(); console.log("window.printing"); for (var i = 0; i < copyFrom.length; i++) { copyFrom[i].style.display = "block"; } printThisBtn.style.display = "block"; } </script> </body></html>
  10. 1 point
  11. 1 point
    I wouldn't count on the filesystem returning data the way you want, I would get the list of all of the files and folders, sort them however you want to sort them, and print the sorted list.
  12. 1 point
    The page is read from top to bottom, if you cal a function that references a specific element in JavaScript before the reading of page reaches it, too JavaScript it does not exist! that is why in the tutorial it says Also you just require html content that you want to include, NOT doctype, head, html or body tags.
  13. 1 point
    I guess I don't understand why you're not setting the value initially, I don't understand what the barrier to doing that is. How about just calling the reset function when the thing loads? That's what I'm talking about for the reset button doing the same thing as when it initially loads.
  14. 1 point
    The general reason is that the variables are out of scope or undefined when the code runs. The specific reason depends on the specific code.
  15. 1 point
    You'll draw using a canvas: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial There's a discussion about animation in general here: https://javascript.info/js-animation
  16. 1 point
    Your for needs a method="POST" attribute.
  17. 1 point
    Thank you Funce ! I will study this until I understand every 'jot and tittle' . You moved me to start a Folder for w3schools-Examples . http://vmars.us/w3schools-Examples/Draggable-Div-Elements-w3Schools-FUNCE.html Thanks again
  18. 1 point
    You can put that tag in the head to load that file, and the code in that file should use the DOMContentLoaded event to make sure the code runs after the page finishes loading.
  19. 1 point
  20. 1 point
    dsonesuk Here's what I mean , see image :
  21. 1 point
    Requesting a Javascript file isn't going to run any PHP code unless the web server is configured to send .js files to PHP. You could name the file with a .php extension if you need to dynamically create Javascript code for whatever reason.
  22. 1 point
    Any database supports multi-user access, the database will let several different applications connect at once. I don't know what you mean, what are you saving? That's what a database is for. Have page to update the header text in the database, and the other pages should get the text from the database and display it.
  23. 1 point
    The second argument of the Object.create() method contains property definitions which follow a specific format. In your code, the definition of getFoo is saying that its value is a function and that it is enumerable. You can see all of the different features that a definition can have here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties#Parameters If you want your code to behave as you predicted, just drop the Object.create() method and assign the object directly: var jsonLinkObj = { getFoo: { value: function() { return this.foo = 1; }, enumerable: false } }; The purpose of Object.create() is mainly for copying existing objects, if you are just creating a new one you probably don't need it.
  24. 1 point
    It sounds like you think your code is the same as this: var jsonLikeObj = { getFoo: { value: function() { return this.foo = 1; }, enumerable: false } }; It's not, that's not what Object.create does. That second parameter is a description about how to create the object, it's not the actual object. jsonLikeObj.getFoo.enumerable is also undefined. Why? Because that's not the actual object, it's the specification for the object. It's metadata. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create
  25. 1 point
    Iframes pose their own problems, one of the biggest ones being that the pages in the iframe don't have their URL shown in the address bar, which means that people (and search engines) cannot link back to them.
  26. 1 point
    Probably the easiest and best solution is to install XAMPP or similar server software on your computer. It is very easy to install and there are many more uses for it than just making AJAX requests work. It is default in all browsers today to prevent AJAX requests from local HTML and Javascript files because it could be used by malicious entities to gather information about your computer. There probably is a way to configure the security settings for this but I'd have to search on Google to find out, which is probably something you already know how to do. For Firefox, you probably will find it by typing "about:config" in the address bar which lets you search through thousands of configuration options. I would advise against Javascript includes for a few reasons: Search engines will certainly rank your page lower. Users who have Javascript disabled or browser extensions that strip out Javascript can't see your page properly. The page takes longer to load than if the content were included on the page using a server-side language, this is especially noticeable when viewing the page on mobile connections. If you decide to install a server for testing, I'd also recommend learning a server-side language and using that to include the content instead. It's overall a better experience for the user, the search engines and, in the long term, the people building the website.
  27. 1 point
    Seems 'html, body' is correct but for desktop only, 'window' is used for mobile devices. See here: http://blog.jonathanargentiero.com/jquery-scrolltop-not-working-on-mobile-devices-iphone-ipad-android-phones/
  28. 1 point
    I'm not sure what else it would be, there might be another animation playing still. It seems like there are competing animations. The fact that it doesn't do it if you wait (presumably until after any animations finish) suggests that's the issue.
  29. 1 point
    I imagine that you have a <body> and <html> tags elsewhere. Have you tried using the browser dev tools, if you select that div you can see what stylings are being applied to it. Your CSS is a little interesting, your sans-serif font declaration seems to be after your font-weight? with no semi-colon in between it may be erroring out.
  30. 1 point
    I'd remove all text direction modifiers. They are the Unicode characters 202A, 202B, 202C, 202D, 202E, 202F.
  31. 1 point
    Do you know how to use lists? If so I think you might get a lot of mileage out of the string method .split https://www.w3schools.com/python/ref_string_split.asp
  32. 1 point
    Here's a version if you're not into the whole brevity thing: function getUnique(inputArr, comp) { const unique = inputArr.map(function (e) { // return an array of only one property from the original array of objects (if defined) console.log(e[comp]); return e[comp]; }).map(function (e, i, final) { console.log("final", final); console.log("e", e); console.log("i", i); // return an array of either false values or indexes // this will result in an array where each value is listed only once, in the first position it appears, // and any other appearances will be false // the array will be the same length return final.indexOf(e) === i && i; }).filter(function (e) { console.log("e", e); console.log(inputArr[e]); // this will create an array of objects from the original array in each index from the previously mapped temp array // this will exclude the duplicates because those indexes in the previous array are set to false return inputArr[e]; }).map(function (e) { console.log("e", e); console.log(inputArr[e]); // this will reindex the array to remove "holes" return inputArr[e]; }); console.log(unique); return unique; } var ar = [ { 'prop': 1 }, { 'prop': 2 }, { 'prop': 1 }, { 'prop': 3 }, { 'prop': 1 }, { 'prop': 4 }, { 'prop2': 1 }, { 'prop3': 1 } ]; getUnique(ar, 'prop'); What's the purpose? This function takes an array of objects, and will return an array of those objects that have unique values for a particular property. How do multiple values fit into that? Do you have an example?
  33. 1 point
    The constructor always needs to be public. If you want properties to be private you need to declare them as private first. It's common to declare all of the properties before the methods. class AccountInformation { private $fname; private $connected = false; // you can initialize variables but only to scalar values, you can't initialize a property to another variable public function __construct($fname = '') { $this->fname = $fname; // you can only access a private property from inside this class $this->connect(); // you can only call a private method from inside this class } private function connect() { } } Have you always been in Finland? My wife lived there for 5 years.
  34. 1 point
    Svg tag has its own attributes to make it proportionally responsive by setting it original width height in viewbox.
  35. 1 point
  36. 1 point
    var colour = blue ; Will be treated as variable colour equaling variable blue, so it should be var colour = 'blue'; Depending on what, where, how it is used fill: 'colour', In most cases would be used as 'fill: '+colour+', ' If you need quotes then it would be 'fill: " '+colour+' ", ' OR "fill: ' "+colour+" ', "
  37. 1 point
    Hi. I use some code from w3schools for my business website https://manlyelectronics.com.au/. I am looking forward to improving both.
  38. 1 point
    Temporary add img tag with matching src to image, if you can see the image the path is correct, else correct the path to correct then use same correct path for video. Another problem is that video tag is for html5 doctype, you a using html 4 strict.
  39. 1 point
    I figured this out. It involves nothing more than inserting an img into the button tag, adding the full sized image and other content to the div with the class of "modal-content." Very easy solution. Thank you!
  40. 1 point
    Replace space (which you should NOT have) in file name with hyphen, then try it.
  41. 1 point
    Test each input you get and put any non-empty inputs into an array. Then you can sum the array elements and divide by the array length.
  42. 1 point
    Those are just parameters that get passed to the console application. When the shell executes the console application, it passes all of the command-line parameters to it. One parameter will be "core:archive" and the other will be the --url parameter. It will also have the entire command available. Look up argv and argc in C for a general description about how that works. https://developer.matomo.org/guides/piwik-on-the-command-line
  43. 1 point
    Hi🙋 Hi I'm here to learn and improve. I'm improving in HTML5, CSS3, and JS. Once I have those down, I plan to learn several others. See you on the forum!🖐
  44. 1 point
    I wouldn't say that is true, as new features are introduced Firefox is usually pretty quick to implement them. Also if you have the superhuman power to force everyone to use Chrome, go for it! But! Wouldn't be better to use the option of using the grid-auto-row: and grid-template-row: in this order that will end up giving the same result in all browsers.
  45. 1 point
    If your script is purely php you do not require closing php tag. The setcookie() must be set at top before any html or whitespace. Your code has a empty line-break and then includes another file with empty line-break before setcookie() function result in headers already exist error.
  46. 1 point
    The content of the page in the iframe is inside a wrapper with a white background, while the document itself does not have a set background color. Because of that, the white ends where the content does.
  47. 1 point
    I don't know what the full requirements of your software are, but your code should look something like this: $type2 = 'Some default value'; $type_link = 'Another default value'; if(isset($typeChunks[0]) { $type2 = $typeChunks[0]; } if(isset($typeChunks[1]) { $type_link = $typeChunks[1]; } I'm also not sure why you've wrapped brackets around every single statement, they're not needed. There are also inconsistencies in your variable naming, you should either use all underscores ($type_link, $type_chunks) or all camel case ($typeLink, $typeChunks).
  48. 1 point
    It's correct to wrap property names in quotes in Javascript. JSON stands for "JavaScript Object Notation", after all. If the JSON is in a string as when returned by AJAX, you need to use JSON.parse() to read it, but if you can just have the JSON right in the code itself, you won't need to parse it.
  49. 1 point
    Remove float: left from the gallery and add text-align: center. You're missing a semi-colon after width: 90%, so it's not being interpreted correctly.
  50. 1 point
    This query should work SELECT first.*, AVG(second.rating) AS ratingFROM firstJOIN second ON first.id = second.relatedGROUP BY second.rating
  • Create New...