Jump to content

Search the Community

Showing results for tags 'jscript'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Found 6 results

  1. Hello. I am using a bootstrap responsive ecommerce template. The filter buttons work great! BUT, if you click on a "card" or even on the background, the outline around the button disappears. This is a problem that the original W3 example doesn't have. Any ideas would be greatly appreciated. Here is the original: https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_portfolio_gallery_filter Here is mine: Here is the page: http://help.cccis.com/static/ccc_one/ELCTraining/EstWorkRO.html Here is the filter buttons: <div id="myBtnContainer"> <button class="btn active" onclick="filterSelection('all')">Show all</button> <button class="btn" onclick="filterSelection('estimates')">Estimates</button> <button class="btn" onclick="filterSelection('workfiles')">Workfiles</button> <button class="btn" onclick="filterSelection('ros')">ROs</button> <button class="btn" onclick="filterSelection('checklist')">Direct CheckList</button> <button class="btn" onclick="filterSelection('share')">Estimate Share</button> <button class="btn" onclick="filterSelection('touch')">Touch</button> </div> </div> Here is the javascript: <!-- Bootstrap core JavaScript --> <script src="vendor/jquery/jquery.min.js"></script> <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script> <script> filterSelection("all") // Execute the function and show all columns function filterSelection(c) { var x, i; x = document.getElementsByClassName("column"); if (c == "all") c = ""; // Add the "show" class (display:block) to the filtered elements, and remove the "show" class from the elements that are not selected for (i = 0; i < x.length; i++) { w3RemoveClass(x, "show"); if (x.className.indexOf(c) > -1) w3AddClass(x, "show"); } } // Show filtered elements function w3AddClass(element, name) { var i, arr1, arr2; arr1 = element.className.split(" "); arr2 = name.split(" "); for (i = 0; i < arr2.length; i++) { if (arr1.indexOf(arr2) == -1) { element.className += " " + arr2; } } } // Hide elements that are not selected function w3RemoveClass(element, name) { var i, arr1, arr2; arr1 = element.className.split(" "); arr2 = name.split(" "); for (i = 0; i < arr2.length; i++) { while (arr1.indexOf(arr2) > -1) { arr1.splice(arr1.indexOf(arr2), 1); } } element.className = arr1.join(" "); } // Add active class to the current button (highlight it) var btnContainer = document.getElementById("myBtnContainer"); var btns = btnContainer.getElementsByClassName("btn"); for (var i = 0; i < btns.length; i++) { btns.addEventListener("click", function () { var current = document.getElementsByClassName("active"); current[0].className = current[0].className.replace(" active", ""); this.className += " active"; }); } </script> If you click on a filter button, it works. But if you click on the background, the button does not stay highlighted. HELP!
  2. https://www.w3schools.com/js/js_break.asp below heading: JavaScript Labels "The continue statement (with or without a label reference) can only be used to skip one loop iteration." - this description is not correct "The continue statement (with or without a label reference) can only be used to skip all or the remainder of one loop iteration." - this description is more accurate
  3. Hi Is there a shorter way of writing the following code. (data === "item1" || data === "item2" || data === "item3" || data === "item4") like (data === "item1" to data === "item4") as my list will be over 100 items. Cheers Heres a jsfiddle with the code in it http://jsfiddle.net/8mw1s2zj/6/ Please note this only has to work on IE11 and be jscript. Here is the piece of code var list=document.querySelectorAll("#dragsource li"); for(i=0;i<list.length;i++){ list.draggable=true; list.ondragstart=function(event){ var event=event||window.event; var dt=event.dataTransfer; dt.setData("text", event.target.id); dt.effectAllowed="move"; var data = dt.getData("text"); if((document.getElementById("onoff").value=="On") && (data === "item1" || data === "item2" || data === "item3" || data === "item4")) { (document.getElementById("fruit").style.color = "red") && (document.getElementById("veg").style.color = "black") && (document.getElementById("games").style.color = "black"); } else if((document.getElementById("onoff").value=="On") && (data === "item5" || data === "item6" || data === "item7" || data === "item8")){ (document.getElementById("veg").style.color = "red") && (document.getElementById("fruit").style.color = "black") && (document.getElementById("games").style.color = "black"); } else if((document.getElementById("onoff").value=="On") && (data === "item9" || data === "item10" || data === "item11" || data === "item12")) {(document.getElementById("games").style.color = "red") && (document.getElementById("fruit").style.color = "black") && (document.getElementById("veg").style.color = "black"); } else if((document.getElementById("onoff").value=="Off") && (data === "item1" || data === "item2" || data === "item3" || data === "item4" || data === "item5" || data === "item6" || data === "item7" || data === "item8" || data === "item9" || data === "item10" || data === "item11" || data === "item12")) { (document.getElementById("fruit").style.color = "black") && (document.getElementById("veg").style.color = "black") && (document.getElementById("games").style.color = "black"); } }; }
  4. UPDATE - Drag & Drop is working But need dropped item to be invisable. Again this was working, code in css #fruit > * { display: none; } Code done for each box New jsfiddle -jsfiddle.net/eru2mc2k/1/ Hi My first post here so hope I've posted everything correct. My drag & drop was working fine until I added the following code in script. shuffleList(); function shuffleList(){ var origList = $("#dragsource li").detach(); var newList = origList.clone(); for(var i=0; i<newList.length; i++) { var randomIndex = randomInt(newList.length - i); newList[i] = origList.splice(randomIndex, 1); $("#dragsource").append(newList[i]); } } function randomInt(maxNum){ return Math.floor(Math.random()*maxNum); } $(document).ready(function () { var $lis = $("#dragsource li").hide(); $lis.slice(0,20).show(); var size_li = $lis.length; })I The above code shuffles my list and displays 20 items from it ,which I need Can someone please look at this so the drag and drop work again. Thank you. Here's jsfiddle http://jsfiddle.net/W4Km8/8725/
  5. On my website the slider is not working as desired. The website is www.dancecityperformingarts.com When you click on the name of the dance class the slider moves, but does not move to the page that has the dance class description. It stays at the picture with the business description. When you click on the "details" portion, it takes you to the page that has the correct class description, but the slider does not move to the correct picture. Can anyone tell me if this can be corrected, and if yes, how to correct. I am very new to coding, and I apologize if this is phrased incorrectly or if additional information is needed. ATTN: Moderators, this is my first post. I did read the guidelines and hope I complied. Please advise if I screwed anything up. Thanks for any assistance with my coding problem.
  6. Please forgive me, I'm new at this and old, so the going is slow. 1. If you place multiple functions in .js file, can a functions overwrite or negate other functions? If so, is there special designation that need to be placed in .js file. I'm having trouble with functions not working on the webpage like buttons not working correctly after adding a another function. (I'm not on a live webpage - just learning) 2. Are js files exclusively for functions? Can other things be placed in a .js file besides code that start with function because I've tried other things like example below and could not get them to work in the .js file. example: document.getElementById("bark").innerHTML ="The temperature is " + toCelsius(32) + " Centigrade";‚Äč I had to post that directly in to the body to work. This example is from the tutorial. Any help would be appreciated thanks
  • Create New...