Jump to content


Popular Content

Showing most liked content since 03/20/2017 in all areas

  1. 2 points
    Included files must have <?php ?> blocks around the code.
  2. 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.
  3. 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>
  4. 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.
  5. 1 point
    Seems odd to me that you declare all of the instance variables as public. It is more normal to make them private.
  6. 1 point
    IF you do it correctly $("input[data-class='resultdate'"] Should be $("input[data-class='resultdate']")
  7. 1 point
    You need the defining of x to be in the function itself. At the moment as the page loads from top to bottom and when it reaches the var x = bit, the input at that time is blank, and it never gets updated when function is triggered.
  8. 1 point
    <input type="submit" value="Enviar"> That's all you have to do.
  9. 1 point
  10. 1 point
    I agree that array superglobals in PHP act no differently than any other array. The only difference between a superglobal and any other variable is an entry in one of PHP's internal tables that keeps track of scope, where a superglobal is always in scope. That's the only difference. It is not a different kind of data type than you can use in any other part of PHP. That's why I was saying that it does not matter that it's a superglobal, you check for the existence of values the same way as you do with any other array. Why is that excessive? Do you think there should be a way to check all of the keys at once, and if so, how do you do that? Don't you have to check each one individually no matter how else you do it? If you want to write a function to take an array and a second array of keys, and return true or false if the first array contains every key in the second array, you can do that, but I don't know what the big deal is. It's not like I'm spending a lot of time checking if array keys exist, that's a small part of programming. This is probably the largest discussion I've ever had about checking if array keys exist, it's just not a big deal to verify that things exist before trying to use them. You have the isset function for most cases, and the empty function for the case where you're trying to check if the value exists and contains a non-falsy value.
  11. 1 point
    My solution is to use click/touch instead of hover. Keep in mind also that hover doesn't work on mobile devices, the browser doesn't know when you're just pointing at something.
  12. 1 point
    What do you want to happen if they select a language and also type one in? That's a decision for you to make. The rest is just a little logic when you validate the form.
  13. 1 point
    Because all the menu anchor links are floated left, any non float: left; element placed at beginning will be forced right by these elements. So make it float: left; also.
  14. 1 point
    The following SQL statement is in error $sql = "INSERT INTO users (fname, lname, uname, email, pwd, ) VALUES ('$fname', '$lname', '$uname', '$email' '$pwd')"; You have a comma after the variable name pwd that does not belong, and you left out the necessary comma between the two variable values $email and $pwd. Roddy
  15. 1 point
    I don't think your question is worded correctly, $_POST is available on every request but your browser will only send one request at a time. Meaning you can only submit one form at a time. Anything that you want to be submitted all needs to be in the form. Of course, you can use Javascript to add or remove form elements if you want to build an interface like that. But each request to the server is only 1 request, you don't send multiple requests at the same time other than if you're using ajax to send a bunch of requests, but even so that's not the best idea. If you find yourself sending multiple requests in a short period you probably need a more efficient design, requests have overhead. If you're just asking how you can structure a page with multiple forms where you can figure out which form was submitted, there's a post about that here: http://w3schools.invisionzone.com/topic/12509-php-tips-and-tutorials/ I would assume that the trigger would update the timestamp, but the final word there is to just test it.
  16. 1 point
    If it's returning the code then the server is not executing the file. Maybe the web server doesn't support ASP, maybe it's just not configured correctly.
  17. 1 point
    Place the JavaScript code between <head>..</head> OR <body>...</body> not outside of these.
  18. 1 point
    It probably makes sense to use ajax to submit the data to the server, that way you don't have to refresh the page. There's plenty of information about ajax online. When you build that page in PHP and write out the button to call the function to run the ajax request, you can pass the board ID to that function. If you don't want to use ajax then you can have your PHP form processing code on the same page, all of the PHP code like that should go on the top of the page before you display anything.
  19. 1 point
    That's easy enough to verify. Set up PHP to use an error log, and you can use the error_log function to write anything you want to it. You can make those changes at runtime, although I prefer to set these options in php.ini. ini_set('log_errors', 1); ini_set('error_log', __DIR__ . DIRECTORY_SEPARATOR . 'error.log'); error_reporting(E_ALL); Just make sure that PHP has write access to that error.log file, it will be in the same directory as your PHP script. Then you can use error_log to write whatever data you want to the error log. error_log('$_GET: ' . print_r($_GET, true); error_log('$_POST: ' . print_r($_POST, true)); If I use my browser's developer tools I can see that it sends a request to http://www.grammarcaptive.com/_utilities/php/podcast.php?data_json=[[""%2Cnull]] That %2C would be a comma, so data_json is an array that contains another array which contains an empty string and null. Your query_str variable is an empty string because window.location is http://www.grammarcaptive.com/podcast_dev_copy.php, window.location.search is empty. So pair is an array with 1 element (an empty string), pair[0] is an empty string, and pair[1] is null because it doesn't exist. This doesn't have anything to do with event.preventDefault, that has specific behavior that has nothing to do with ajax.
  20. 1 point
    Some text editors replace standard quotes ("") with curly quotes (“”) which messes up the code. Check your text editor settings to make sure it's not doing that to your quotation marks. If there isn't a setting for that in your text editor then try looking for another one, there are plenty of free ones out there.
  21. 1 point
    The slideIndex will always be 1; When function called var slideIndex = 0; then further on slideIndex++;
  22. 1 point
    You're telling to find an element with the ID "podType". If you want to use the value of the variable, you need to specify that. $('#' + podType)
  23. 1 point
    I haven't tested how jQuery handles that, but I assume that it's only going to execute whatever code was just added to the page. The rest of the code on the page will be executed when the browser gets to that point. I'm referring to the 2 links you posted above. The direct link does not have that link to #60, the "proxy" link does even though they go to the same page. Why, because it's longer? There's nothing unmistakable about 60, as far as the computer is concerned. 60 is also unique and unmistakable. Both 60 and any hash will convert to binary values that are unique, the computer will not confuse them with each other. So they are both values in the same address space of all binary numbers, one of them is just an enormous number but that's the only real difference, they're just numbers. Why would one of them be said to be a quantitatively "better" number than another? Hashes are really only used for one thing - verification. Passwords are stored as hashes and then the hashes are computed to verify that the entered password matches the stored one, or a file might be distributed along with a checksum hash to verify the integrity of the file, that the file you actually saved is the one they distributed, there was no error in transmission. Hashes don't really offer anything as identifiers that you can't get with any other numeric value, and a hash is just a numeric value represented in a different base. One problem I see with using both a hash and an ID is that people cannot find the pages if they only know the ID. If I think you said something great in podcast 60 and I want to share it with someone else, I can't just check the URL and figure out where the ID goes in the URL, I also need to know some long hash that I can't calculate just by knowing that the podcast was number 60. So the only thing I can do is try to find a link to that page somewhere else, I can't just type it in manually. If that's your goal, if you're trying to add some sort of protection against people being able to figure out the URL for any podcast, if you're trying to control access in some way where they need the specific URL and not just the ID, then that would be the result of requiring the hash to be in the URL. Don't think of it like that, PHP and Javascript don't share any values or anything like that, the only relationship is that you're using PHP to output Javascript code. They don't run in the same address space, they don't even run on the same computer (PHP runs on the server, Javascript runs in the browser). As far as PHP is concerned, it's all just text being sent to the browser, PHP doesn't care whether it's Javascript text or HTML text or any other kind, it's just output. So all you have to do is output that Javascript code outside of the element that is being cloned or copied. I can't specifically tell you how to do that, I'm not looking at everything that you are. I assume you have templates or something with all of that stuff in it, so just make sure the Javascript code to copy the content is not part of the content that gets copied.
  24. 1 point
    IF you still want to use console.() to call function with argument, store each value in variable and return THAT final result to console.log function calculate(n) { var results = ""; for (i = 0; i <= n; i++) { var isprime = false; for (j = 2; j <= n; j++) { if (i % j === 0 && i !== j) { isprime = true; } } if (isprime === false) { results += i + "\n"; } } return results; } console.log(calculate(25));
  25. 1 point
    There isn't really any support for using a phone's fingerprint scanner through a browser. Most applications that use fingerprint authentication will connect to a fingerprint reader attached to the server or another network device.
  26. 1 point
    The idea of a foreign key is that the database would not allow you to enter a non-existent order_number in your cust_time table. It would only accept order_numbers that already exist in the customer table.
  27. 1 point
    Unless you actually echo out the username, password you won't see these.
  28. 1 point
    Maybe you didn't do the port fowarding thingy correctly, or maybe your ISP is just blocking incoming traffic on port 80.
  29. 1 point
    The page itself opens, but the developer tools show a 404 on one of the Javascript files I think.
  30. 1 point
    Have you tried this? <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title> HTML5 page </title> </head> <body> <div class="form-group"> <label class="col-sm-4 control-label">Checkbox inputs</label> <div class="col-sm-8"> <div class="checkbox check-transparent"> <label for="opt01">Option 1</label> <input type="checkbox" value="1" id="opt01" checked> </div> <div class="checkbox check-transparent"> <label for="opt02">Option 2</label> <input type="checkbox" value="1" id="opt02"> </div> <div class="checkbox check-transparent"> <label for="opt03">Option 3</label> <input type="checkbox" value="1" id="opt03"> </div> </div> <div> </body> </html>
  31. 1 point
    You want what to happen, an anchor to get created or edited or something? Like with most things, instead of finding something that tells you exactly how to do specifically what you want to do, you need to understand the basics and the theory yourself so that you can apply that to build what you want. You can start here, but there's a lot more information online about dragging and dropping. https://www.w3schools.com/html/html5_draganddrop.asp
  32. 1 point
    Maybe they don't have example files on their server for you to use. You can open any other editor and add video and track tags if you want to though, as long as there are files online somewhere that you can point to.
  33. 1 point
    I have a issue and there might be multiple ways to solve it. I want a button to reveal extra content when it is clicked. I want to slide the extra content in from the left using the w3.animations or any other method that would be easy to follow and have it stop in the center of the screen. The content is a image and a few words describing it in a organized container. How would I do this or do you have any general advice for me to follow?
  34. 1 point
    You should always provide a pure php script, to sanitize and validate, BECAUSE JavaScript CAN be disabled, You can use AJAX to update content, make database requests/update/insert etc without the need to reload the page constantly, which is required for pure php code to do the same thing. Usually you would not include the php script in the form page, only the AJAX JavaScript code would access it externally, to process the form data and return results to a specific location, it makes more sense this way checking with $_SERVER['HTTP_X_REQUESTED_WITH'] that it is a AJAX request. Without this it could be included in the form page, it would retrieve default information or content on loading of page, a AJAX request could be made using form using the same php script externally, the new AJAX returned results can be use to update/overwrite the default content without reloading the page.
  35. 1 point
    Its AJAX, it does not require those, without action the form will submit to itself, and as that php file is included in the form page itself, which maybe used to takes into account if JavaScript is disabled it will then as said be submitted, page reloaded and processed by the same page, BUT! currently it will only show if AJAX request is sent ($_SERVER['HTTP_X_REQUESTED_WITH']), which seems pointless including in the form page as a non JavaScript alternative. While with JavaScript enabled, the form is prevented from being submitted, it gathers the input data and sends it to the php file specified in the JavaScript AJAX url code to be processed and return the result without reloading of page
  36. 1 point
    The superglobal is like any other variable in the PHP process, it only exists during the time the script is running. If you want to store its value permanently somewhere you can use a database or write it to a file. If you want to store something for one user during a browsing session you can use PHP sessions.
  37. 1 point
    The RSS file can go anywhere you want, you just have to tell people where to find it. As I mentioned earlier, you can tell browsers where to find a feed by putting a <link> tag in your HTML page. There's no real best practice as to where to place your RSS feed files. I think RSS feeds have to use absolute URLs in the <link> tags including protocol and domain name to point to the location of the files. If you want a URL like "/feed" for your RSS feed you would have to use URL rewriting on the server, a regular URL would look like this instead: "/feed.xml" or "/feed.rss".
  38. 1 point
    Yep. The alternative is to not list the columns in the table and only give the values: INSERT INTO table VALUES ('val1', 'val2', 'val3') But, like I said, if you ever change the structure of that table then that query is going to break if you've changed the number of columns. It's best to just list everything out explicitly. You don't have to pay per character in your source code, make the code as obvious as possible so that it's easy to maintain. Ease of maintenance should always be a higher priority than something like how long the code is.
  39. 1 point
    You should only need one function. First set up your buttons to each have a value: <button type="button" class="add-panel" data-value="4 Panel Smooth">Add 4 Panel Smooth</button><br><br> <button type="button" class="add-panel" data-value="4 Panel Grained">Add 4 Panel Grained</button><br><br> <button type="button" class="add-panel" data-value="4 Panel Grained 2 Glazed">Add 4 Panel Grained Glazed</button><br><br> Create the list that will contain the values: <ul id="demo"></ul> Set up an event listener for the buttons: var buttons = document.getElementsByClassName("add-panel"); for(var i = 0; i < buttons.length; i++) { buttons[i].addEventListener("click", addPanel, false); } Create the event handler that updates the array and displays its contents in the HTML: var panels = []; function addPanel(e) { // Get a reference to the button that was clicked var button = e.currentTarget; // Add the button's value to the array panels.push(button.getAttribute("data-value")); // Display the contents of the array on the page by generating <li> elements. var demo = document.getElementById("demo"); demo.innerHTML = ""; var li; for(var i = 0; i < panels.length; i++) { li = document.createElement("li"); li.innerHTML = panels[i]; demo.appendChild(li); } }
  40. 1 point
    You should get in the habit of structuring your code like Ingolme mentions. Put your PHP code first that will decide what the page is even going to do, and output HTML and whatever later on. If you're just going to redirect there's no reason to output a bunch of HTML anyway, right? So figure out first if you're going to redirect or show HTML or whatever else, and then do that.
  41. 1 point
    An id reference must be unique within a page, only class names can be used multiple times, so you would have to loop through classnames and make changes to next sibling img src attribute.
  42. 1 point
    Then you would have to make tmp duplicate array, of the array of ordered selected items, loop though selected items from dropdown and if identical remove, you should end up with last item deselected. Then remove this item from original array of selected items. Use .indexOf() to find matching values.
  43. 1 point
    Had to make slight change, correct invalid html, which you should validate at https://validator.w3.org/ before posting <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" id="viewport" content="target-densitydpi=high-dpi,initial-scale=1.0" /> <title>Document Title</title> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script> <style type="text/css"> #mydropdown option:hover { background: #c8c8c8; } #mydropdown option { padding: 5px; } .mydivs1 { display: none; } br { display: block; content: ""; margin-top: 5px; } .mydivs1 { border: 1px solid black; padding: 5px; height: 211px; width: 172px; margin-left: 5px; background-color: #ff8080; } .mydivs2 { border: 1px solid black; padding: 5px; height: 199px; width: 35px; float: left; background-color: #b3e6b3; } .mydivs3 { border: 1px solid black; height: 199px; width: 103px; margin-left: 52px; padding-left: 10px; padding-right: 5px; padding-top: 5px; padding-bottom: 5px; background-color: #cce6ff; } </style> </head> <body> <input type="text" id="mytextbox" placeholder="Search Foods"> <p></p> <select id="mydropdown" multiple="multiple"> <option value="optionx_Fruits">Fruits</option> <option value="optionx_Vegetables">Vegetables</option> <option value="optionx_Nuts">Nuts</option> <option value="optionx_Meats">Meats</option> </select> <p></p> Results: <p></p> <div id="results"> <div class="mydivs1" id="optionx_Fruits"> <!--match="optionx Fruits"--> <div class="mydivs2"> <button class="button1">X</button> <p style="clear:both"></p> <button class="button2">C</button> </div> <div class="mydivs3"> <span class="myspan1">Fruits</span> <p></p> <span class="myspan2">1:</span> <br> <span class="myspan3">Avocados</span> <p></p> <span class="myspan2">2:</span> <br> <span class="myspan3">Blackberries</span> <p></p> <span class="myspan2">3:</span> <BR> <span class="myspan3">Raspberries</span> </div> <p></p> </div> <p></p> <div class="mydivs1" id="optionx_Vegetables"> <!--match="optionx Vegetables"--> <div class="mydivs2"> <button class="button1">X</button> <p style="clear:both"></p> <button class="button2">C</button> </div> <div class="mydivs3"> <span class="myspan1">Vegetables</span> <p></p> <span class="myspan2">1:</span> <br> <span class="myspan3">Beets</span> <p></p> <span class="myspan2">2:</span> <br> <span class="myspan3">Eggplants</span> <p></p> <span class="myspan2">3:</span> <BR> <span class="myspan3">Spinach</span> </div> <p></p> </div> <p></p> <div class="mydivs1" id="optionx_Nuts"> <!--match="optionx Nuts"--> <div class="mydivs2"> <button class="button1">X</button> <p style="clear:both"></p> <button class="button2">C</button> </div> <div class="mydivs3"> <span class="myspan1">Nuts</span> <p></p> <span class="myspan2">1:</span> <br> <span class="myspan3">Almonds</span> <p></p> <span class="myspan2">2:</span> <br> <span class="myspan3">Pecans</span> <p></p> <span class="myspan2">3:</span> <BR> <span class="myspan3">Walnuts</span> </div> <p></p> </div> <p></p> <div class="mydivs1" id="optionx_Meats"><!--match="optionx Meats"--> <div class="mydivs2"> <button class="button1">X</button> <p style="clear:both"></p> <button class="button2">C</button> </div> <div class="mydivs3"> <span class="myspan1">Meats</span> <p></p> <span class="myspan2">1:</span> <br> <span class="myspan3">Chicken</span> <p></p> <span class="myspan2">2:</span> <br> <span class="myspan3">Fish</span> <p></p> <span class="myspan2">3:</span> <BR> <span class="myspan3">Turkey</span> </div> <p></p> </div> </div> <p></p> <!-- Original script --> <script type="text/javascript"> /* jQuery.fn.filterByText = function(mytextbox) { return this.each(function() { var select = this; var options = []; $(mydropdown).find('option').each(function() { options.push({ value: $(this).val(), text: $(this).text() }); }); $(mydropdown).data('options', options); $(mytextbox).bind('change keyup', function() { var options = $(mydropdown).empty().data('options'); var search = $.trim($(this).val().replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&")); var regex = new RegExp(search, "gi"); $.each(options, function(i) { var option = options[i]; if (option.text.match(regex) !== null) { $(mydropdown).append( $('<option>').text(option.text).val(option.value) ); } }); }); }); }; $(function() { $('#mydropdown').filterByText($('#mytextbox'), true); });*/ /* $(document).ready(function() { function exists(elemt, arr) { return (jQuery.inArray(elemt, arr) > -1); } $('#mydropdown').change(function() { var $selected = $(this).val(); $('.mydivs1').each(function() { $(this).toggle()[ (exists($(this).attr('match'), $selected)) ? 'show' : 'hide'](); }); }); });*/ </script> <!--NEW Script --> <script> var SelOrderArray = []; $('#mydropdown').on('change keyup', function() { $('.mydivs1').hide(); var $selected = $(this).val(); if ($selected.length > 0) { $.each($selected, function(i) { //loop through selected possible multiple selected options if (SelOrderArray.indexOf($selected[i]) === -1) { //if current looped through $selected value not in array then add to array SelOrderArray.push($selected[i]); } }); } else { SelOrderArray.push($selected[i]); } // loop through ordered array of slected options $.each(SelOrderArray, function(i) { //clone element with specific id to temp storage variable var TmpDivClone = $("#" + SelOrderArray[i]).clone(); //remove current existing element with specific id $("#" + SelOrderArray[i]).remove(); // prepend temp cloned element to div #result wrapping mydiv1 elements so prepending remains below dropdown and show TmpDivClone.prependTo('#results').show(); }); }); </script> </body> </html>
  44. 1 point
    There are three aspects to take into account in a web page: Content: HTML Presentation: CSS Behavior: Javascript The same way we want to separate content from presentation, we also want to separate content from behavior. Javascript should only be inside <script> elements, CSS should only be in <style> or <link> elements and HTML should not be polluted with attributes concerning behavior and presentation. You wouldn't use align and bgcolor attributes, so why would you use onclick attributes? In your original code, otherTongue is restricted to the local scope of the function it was declared in, it's not accessible from outside. That's why the onchange event attribute can't find it, the event attribute is looking for a global function.
  45. 1 point
    With the code I provided, it does not require being placed in function, it runs its own anonymous function if a specific classed element within a specific parent id element is clicked even if a specific currently classed element already exists OR is newly created which is what 'on()' is specifically used for.
  46. 1 point
    It's possible using data URLs as the src attribute of the <img> element: https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs I don't recommend it because older versions of Internet Explorer wouldn't support it and because it could really slow down the page loading depending on how large the images are. Normally, the page continues loading while requests for images are being processed but by using Data URLs, the image has to be fully loaded before loading the next element in the page. Also, base64 encoding increases the size of the image by 33%. Just include the PHP files in the src attribute of the <img> elements.
  47. 1 point
    A lot of questions asked here in this forum can be answered simply by reading the tutorials, and most often what people are asking are actually examples in the w3school main website. Some questions are even extremely similar, but yet people ask the same questions all over again.That "please-read-the-tutorial-first" message pinned at every forum apparently DOES NOT work.I firmly believe that this forum is created to answer questions that the w3schools main website does not answer.I do not have a solution for this. But this would just serve as a precaution. Because basically when this forum grows. Then a lot new topics will be started.Then probably, we will be reading a bunch of repetitive questions being asked all over and over and over again.And please forum members, please dont post for the sake of increasing your post count. Post for the sake of answering questions being asked.And if you wish to promote your website here, we cant/wont stop you with it, but please do it in an ETHICAL way. There is no excuse for not having any manners/ethics.And lastly, this forum, in my humble opinion, is used for answering questions (or some code snippets) not for asking for full/complete scripts.This is just my opinion. You might think i'm wrong, but really i think i am right with this one. You just have to agree with me here.
  48. 1 point
    It is a nice way to interact with GitHub, but it isnt a GUI for just using Git. Still, very useful since sometimes its hard to remember the commands for pushing to GitHub like "git push origin master"
  49. 1 point
    For many people, tutorials aren't explained in a way to them, where they can actually understand what they are saying, whereas if you had a human who can actively explain how to do something, like a javascript function to resize a window, then that should be fine.That is my opinion and I shall stick by it. ;O
  50. 1 point