Jump to content


Popular Content

Showing content with the highest reputation since 09/07/2011 in all areas

  1. 2 points
    That was the days of html4 with strict doctype no longer supporting it, it was my main gripe as there was not cross browser support for anything else similar, so you had to use transitional doctype which allowed iframes. Then whoever realised what a major blunder they made, and it was resupported in html5
  2. 2 points
    You should call exit or die any time you're redirecting a user to prevent the code from executing any of the instructions that are further down. Nothing about the header() function tells the code to stop executing. header('Location: /Logon/Logon.php?From=Home'); exit;
  3. 2 points
    Use flex box <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Document Title</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="author" content=""> <!--<link rel="stylesheet" href="css/styles.css?v=1.0"> --> <style> *{box-sizing: border-box;} .layout-wrap { display: flex; min-height: calc(1px + 40vw);} .layout-col1{ display: flex; flex: 1 1 100%; max-width: 40%;} .layout-col2{display: flex; flex: 1 1 100%; max-width: 60%; flex-wrap: wrap; justify-content: space-evenly; } .layout-col2 >div, .layout-col1 >div { margin: 10px; border: 3px solid #000;} .div1 {flex: 1 1 auto;} .div2 { flex: 1 1 auto; max-width: 40%; margin-right: 5px;} .div3 { flex: 1 1 auto; max-width: 60%; margin-left: 5px;} .div4 { flex: 1 1 100%; max-width: calc(100% - 20px);} </style> </head> <body> <!--<script src="js/scripts.js"></script> --> <div class="layout-wrap"> <div class="layout-col1"> <div class="div1"></div> </div> <div class="layout-col2"> <div class="div2"></div> <div class="div3"></div> <div class="div4"></div> </div> </div> </body> </html>
  4. 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.
  5. 2 points
    class whatever { function func1 { do stuff } function func2 { do stuff } } object = new whatever(blah,blah2); object->funct1(); object->funct2();
  6. 2 points
    Gosh! you and rizwansyed must be working with identical school exercise book, both working with a circuit board, communicating with server and file on sd card, and now same identical form inputs requiring the SAME effect on selection, must be biggest coincidence in the whole milky way galaxy. hmmm Also you could use required attribute that will give a warning that selection is required if first option has empty value.
  7. 2 points
    Regardless of native JS or JQuery, perhaps this would help with your understanding: <script> var globalVar = 'globalVar'; function parentFunc() { // no function parameters var parentVar = 'parentVar'; function childFunc() { // not function parameters var childVar = 'childVar'; alert('childFunc has access to:\n'+childVar+'\n'+parentVar+'\n'+globalVar); } childFunc(); alert('parentFunc has access to:\n'+parentVar+'\n'+globalVar); } alert('body has access to only:\n'+globalVar); parentFunc(); </script>
  8. 2 points
    I tested and the scoped attribute does not work. According to MDN, Firefox should support it, but it also says that the attribute is deprecated so it's best not to use it. Since the scoped attribute is deprecated, <style> elements should only go in the <head> section of the document.
  9. 2 points
    No one has to use your form, if you have a page that accepts input from $_GET or $_POST anyone can send anything they want to that page. Make sure you validate your inputs.
  10. 2 points
    By changing the prototype of a data type, you change every single object of that type. In this example, they are changing the prototype of the String object so that all strings have a trim() method. The trim() method removes spaces from the beginning and end of a string. The code you see in the replace() method /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g is called a regular expression, it is used to do complex manipulations with strings. There is a tutorial page about regular expressions here: https://www.w3schools.com/js/js_regexp.asp
  11. 2 points
    To be responsive, you shouldn't us a fixed width using px, unless you use media queries to adjust width and html content structure as the device increases or decreases. You are using max-width: on wrapper div, which makes this element responsive up to a specific max-width. Most responsive sites use percentages widths for inner html structure within the fixed width container element, these also will use media queries to change from 3 to 2 to a 1 single column structure for mobile devices. Once this responsive page is working as it should, you can then think about adding all the other features like shopping cart images etc.
  12. 2 points
    No. UPDATE is what you use to start an UPDATE query when you are updating the table. It is not a command on its own. You might be thinking of commit, but you only need to commit if you're using transactions, which it doesn't look like you are. When you insert a record outside of a transaction there's nothing else you need to do to actually insert the record, just the insert query will do it. My condolences.
  13. 2 points
    The purpose of an object template, such as "Person" is for organizing code. In any part of your software, if you are given an object of type Person you know for sure that you can find a name and age property on it. If the object has no type then you don't know what properties it might have. You would use an object template if your software uses the same kind of object a lot. If you're only using the object in one place then you can use the shorthand {} to define it.
  14. 2 points
    Included files must have <?php ?> blocks around the code.
  15. 2 points
    There's nothing formal to tell you things like that. People do it themselves, and it tends to illustrate the Dunning-Kruger effect. People who just recently started tend to rate themselves highly, and only when you get more into something do you realize how much you don't know. I wouldn't put any weight on things like that. If you want to evaluate someone's capabilities look for a portfolio or things they've actually finished.
  16. 2 points
    Unfortunately this site has no connection with the administrators of w3shools.com, posting this error here, won't receive any attention to fix this error, but I suggest you go to 'About' page on W3schools.com then at bottom of page, click report error link.
  17. 2 points
    You had wrongly referenced a JavaScript function, and wrongly named a css selector so very important position: relative was not applied. <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> * {box-sizing:border-box} body {font-family: Verdana,sans-serif;margin:0} .mySlides {display:none; width: 100%;} /* Slideshow container */ .slideshow { /*NOT slideshow-container*/ max-width: 1000px; position: relative; margin: auto; } /* Next & previous buttons */ .prev, .next { cursor: pointer; position: absolute; top: 50%; width: auto; padding: 16px; margin-top: -22px; color: white; font-weight: bold; font-size: 18px; transition: 0.6s ease; border-radius: 0 3px 3px 0; } /* Position the "next button" to the right */ .next { right: 0; border-radius: 3px 0 0 3px; } /* On hover, add a black background color with a little bit see-through */ .prev:hover, .next:hover { background-color: rgba(0,0,0,0.8); } /* Caption text */ .text { color: #f2f2f2; font-size: 15px; padding: 8px 12px; position: absolute; bottom: 8px; width: 100%; text-align: center; } /* Number text (1/3 etc) */ .numbertext { color: #f2f2f2; font-size: 12px; padding: 8px 12px; position: absolute; top: 0; } /* The dots/bullets/indicators */ .dot { cursor:pointer; height: 13px; width: 13px; margin: 0 2px; background-color: #bbb; border-radius: 50%; display: inline-block; transition: background-color 0.6s ease; } .active, .dot:hover { background-color: #f44336; } /* Fading animation */ .fade { -webkit-animation-name: fade; -webkit-animation-duration: 1.5s; animation-name: fade; animation-duration: 1.5s; } @-webkit-keyframes fade { from {opacity: .4} to {opacity: 1} } @keyframes fade { from {opacity: .4} to {opacity: 1} } /* On smaller screens, decrease text size */ @media only screen and (max-width: 300px) { .prev, .next,.text {font-size: 11px} } </style> </head> <body> <div id="wrapper"> <div class="slideshow w3-container w3-half"> <div class="w3-content w3-display-container"> <img class="mySlides fade" src="https://www.w3schools.com/howto/img_nature_wide.jpg"> <img class="mySlides fade" src="https://www.w3schools.com/howto/img_fjords_wide.jpg"> <a class="prev" onclick="plusDivs(-1, 0)">&#10094;</a> <a class="next" onclick="plusDivs(1, 0)">&#10095;</a> <!-- Extra plusDivs parameter refers to first (0) slideshow (start from 0) --> </div> <br> <div style="text-align:center"> <span class="dot" onclick="currentDiv(1, 0)"></span> <span class="dot" onclick="currentDiv(2, 0)"></span> </div> </div> <hr> <div class="slideshow w3-container w3-half"> <div class="w3-content w3-display-container"> <img class="mySlides fade" src="https://www.w3schools.com/howto/img_nature_wide.jpg"> <img class="mySlides fade" src="https://www.w3schools.com/howto/img_fjords_wide.jpg"> <a class="prev" onclick="plusDivs(-1, 1)">&#10094;</a> <a class="next" onclick="plusDivs(1, 1)">&#10095;</a> <!-- Extra plusDivs parameter refers to second (1) slideshow (start from 0) --> </div> <br> <div style="text-align:center"> <span class="dot" onclick="currentDiv(1, 1)"></span> <span class="dot" onclick="currentDiv(2, 1)"></span> </div> </div> <script> var slideIndex = 1; var z = document.getElementsByClassName("slideshow"); for (i = 0; i < z.length; i++) { //set custom data attribute to first current image index z[i].setAttribute("data-currentslide", 1); showDivs(z[i].getAttribute("data-currentslide"), i); } function plusDivs(n, j) { //get custom data attribute value of current image index to slideshow class index j slideIndex = parseInt(z[j].getAttribute("data-currentslide")[0]); showDivs(slideIndex += n, j); } function currentDiv(n, j) { showDivs(slideIndex = n, j); /* showDivs Not showSlides*/ } function showDivs(n, j) { var i; var z = document.getElementsByClassName("slideshow")[j]; var x = z.getElementsByClassName("mySlides"); var dots = z.getElementsByClassName("dot"); if (n > x.length) { slideIndex = 1 } if (n < 1) { slideIndex = x.length; } //set custom data attribute to current image index z.setAttribute("data-currentslide", slideIndex); for (i = 0; i < x.length; i++) { x[i].style.display = "none"; } for (i = 0; i < dots.length; i++) { dots[i].className = dots[i].className.replace(" active", ""); } x[slideIndex - 1].style.display = "block"; dots[slideIndex - 1].className += " active"; } </script> </div> </body> </html>
  18. 2 points
    I don't know where there's a list. Generally you should never develop for specific devices, you should just make your layout flexible enough (with help of media queries) to wotk on any screen regardless of size. This is usually achieved by testing your page in the responsive mode of your browser and resizing the viewport until it breaks, then you add a media query to correct the layout. But for reference, I start off with a design for the following devices, then make extra adjustments later: Small mobile (iPhone 4):Up to 374px (I usually use this just for specific elements that didn't fit) Mobile or small mobile in landscape): Up to 767px Tablet portrait: 768px Tablet landscape: 1024px (breakpoint usually between 800px and 900px) Desktop: 1025px and above Some people make designs for large desktop computers (1440px and above), but that's up to you. In general, there isn't one specific strategy for responsive design, this is just the approach from the companies I work with.
  19. 2 points
    Like astralaaron said using closest class and the index class in jquery you can get the index of the tr, have a look at the fiddle. https://jsfiddle.net/8hL46ftj/ hope this helps $('img').click(function(){ alert($(this).closest('tr').index()) })
  20. 1 point
    The most information you'll be able to gather from my page, is that it updates every 5 minutes, is slow to load the first time, and works nearly instantly from thereafter until the next 5 minute rotation. Here's the link: https://www.championfreight.co.nz/currency (It has a note on when it was last updated) The slow loads are updating the Database with the API, then displaying the data. The fast page loads are loading from the Database without updating, as the Data hasn't aged enough for me to need to update from the API. A very high level overview: RAM vs Disk. Disk is slow, and updates the RAM. The RAM is fast, and can respond to multiple commands quickly, as it can access its own data very quickly, but would need to update from the Disk if it gets a request it isn't expecting, and lacks the data required. In this scenario: Your Matomo would be the Disk, with the absolute values required at any time. The RAM would be a database you create and host on your own server. Its super fast, due to it being hosted in the same place, but periodically needs to get the up to date values from Matomo. I store a timestamp with the values I retrieve, so I check the timestamp, and if its too old, I get new values. In your case: AJAX asks for Data from PHP PHP gets Data from Database and checks when it was received If its recent enough, PHP returns the data back to AJAX, If its not, PHP asks Matomo for the Data Matomo reports and returns the Data to PHP PHP updates Database with Data, and a timestamp for checking later PHP then returns the Data back to AJAX If you don't like the idea of a slow load, if your hosting provider allows scheduled tasks, just run the page on the scheduler. The page load from the Scheduler will pull all the Data required, and none of your users will experience any slowdown of experience.
  21. 1 point
    Look up the return transfer option to see what it does. cURL outputs the response by default unless you tell it not to.
  22. 1 point
    I've been pretty busy so I've just been answering short questions that don't need a lot of research. I think you probably intended to do an assignment here instead of a comparison. if(typeof navtype != "undefined" && navtype !== null) { performance.navigation.type === 1; } I actually have never worked with the performance.navigation object, so I don't even know what it's for. I'll look it up once I have the time.
  23. 1 point
    Like I said though, with a 1-to-1 relationship you usually put all of that in one table. It's not normal to have a primary key that is also a foreign key.
  • Create New...