Jump to content

Search the Community

Showing results for tags 'javascipt'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

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

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 15 results

  1. I followed the tutorial to create an accordion. Now, I would like to link to individual headers in that accordion and have them load opened. How can I edit the code to do this? Here is what I'm using: <style type="text/css">.accordion { background: none; color: #3d8bb1; cursor: pointer; padding: 18px; width: 100%; border: none; text-align: left; outline: none; font-size: 18px; font-weight: bold; transition: 0.4s; } .active, .accordion:hover { background: none; color: #2e6885; } .accordion:after { content: '\002B'; color: #2e6885; font-weight: bold; float: right; margin-left: 5px; } .active:after { content: "\2212"; } .panel { padding: 0 18px; background-color: white; max-height: 0; overflow: hidden; transition: max-height 0.2s ease-out; } </style> <button class="accordion">TITLE</button> <div class="panel"> <p> CONTENT</p> </div> <button class="accordion">TITLE</button> <div class="panel"> <p>CONTENT</p> </div> <script> var acc = document.getElementsByClassName("accordion"); var i; for (i = 0; i < acc.length; i++) { acc[i].addEventListener("click", function() { this.classList.toggle("active"); var panel = this.nextElementSibling; if (panel.style.maxHeight){ panel.style.maxHeight = null; } else { panel.style.maxHeight = panel.scrollHeight + "px"; } }); } </script>
  2. hello all i am trying to use 'keydown' function to move through html rows. but i could not succeed. here is what i tried-- $("body").on("keyup", function(e) { if ($("#mid").find(".maintable tr[data-selected='Y']").length == 0) { $("#mid").find(".maintable tr").first().data("selected", 'Y').addClass("thisrow"); } else { if (e.which === 40) { $("#mid").find(".maintable tr[data-selected='Y']").next().data("selected", 'Y').addClass("thisrow"); $("#mid").find(".maintable tr[data-selected='Y']").first().data("selected", 'N').removeClass("thisrow"); } else if (e.which === 38) { $("#mid").find(".maintable tr[data-selected='Y']").prev().data("selected", 'Y').addClass("thisrow"); $("#mid").find(".maintable tr[data-selected='Y']").last().data("selected", 'N').removeClass("thisrow"); } } }) in the above code, '#mid' is a div that holds data retrieved from jQuery.ajax function. below is the backend code data from which is attached to the '#mid' div. $data = "<table class='maintable'>"; $sn = 0; while ($r = $q->fetch_object()) { $sn++; $name = $r->name; $aid = $r->aid; $ac_id = $r->ac_id; $ob = $r->ob; $data .= " <tr data-target='acregister.php?aid=$aid&m=e' data-selected='N'> <td>$name</td> <td style='width: 150px;'>$ac_id</td> <td style='width: 150px;'>$ob</td> </tr>"; } $data .= "</table>"; echo $data; here i want to use up and down arrows to move through the rows retrieved from ajax function. on the rows i've attached 'data-selected' value to know which row is selected. and on each keydown function i want change the 'data-selected' value of next row to 'Y' and change its value to 'N' for the previous one. the above code worked only once. it changed the value for new row but didnot change the value for the previous one and hence when i press down arrow, it selects first row but does not move to next row on another down arrow press. please guide me, what i missed?
  3. Dear all, I managed a web interface under Linux/Apache. This interface must start and stop some shell scripts, through HTML buttons. My goal is to use just only one HTML button to do 3 actions: 1- Stop a shell script 2- Open a new HTML page 3- Start a new shell script So, usually, I will drive it like this: <script language="javascript"> function button() { function1(); function2(); function3(); } </script> But my problem is what kind of Javascript function is able to start and stop a shell script ? I found various answer with PHP, but I don't want use it ! Just HTML/JAVASCRIPT. Can you please help me ? Thank you for your support and help. Best regards,
  4. HI, I'm sure I've seen on a websites somewhere the ability to either select an option from a dropdown list or enter an alternative. Can anyone give me any pointers in how to achieve this? Thanks Phil
  5. Hello, w3schools. I like your tutorials very much and used to come to this site daily. I would love, if it possible, that you created some webgl or ThreeJS tutorials. I really want to learn how to create 3D graphics on the web, so please if you can, create tutorials that cover WebGL or ThreeJS. I'd prefer ThreeJS. Anyway, thanks in advance. Sincerely, Vlad Kvaskov
  6. Hi I am new to javascript and was creating search suggestions referring to the article on https://www.w3schools.com/howto/howto_js_filter_lists.asp , but the search suggestions in output are not sorted. Can someone guide me on updating this code to get alphabetically sorted suggestions? Thanks in advance
  7. chob1234

    Rounding

    Confused on why my toFixed(2) function is not rounding my output. Located at the bottom of my code here. My output is "501327.3600770543" //// Get the sq inch. for BuildIDs that start with AA and //// sets value to the "result" variable var result=0; var params = { maxItems: 100000 /* NUMBER */ }; //// result: INFOTABLE var itPartInfo = Things["Training.InfoTable.PartInfo"].GetDataTableEntries(params); // Return square inches of Oak needed for each build ID that starts with AA // Like type filters by a like criteria // filters rows from Infotable PartInfo var query = { filters: { "type": "AND", filters: [ { "fieldName": "BuildID", "type": "LIKE", "value": "AA*" }, { "fieldName": "MaterialType", "type": "EQ", "value": "Oak" } ] } }; var oakparams = { t: itPartInfo /* INFOTABLE */, query: query /* QUERY */ }; // result: INFOTABLE var sqresult = Resources["InfoTableFunctions"].Query(oakparams); //Infotable for loop snippet var tableLength = sqresult.rows.length; // for loop will loop through itPartInfo, calculate the sq. in. for each part that starts with AA and return // sq. in. in "result" for (var x = 0; x < tableLength; x++) { var row = sqresult.rows[x]; //Your code here //+= addition assignment operator is basically same as "x = x + y" result += (row.Height*row.Width); result.toFixed(2); }
  8. var params = { maxItems: 100000 /* NUMBER */ }; //// result: INFOTABLE var itPartInfo = Things["Training.InfoTable.PartInfo"].GetDataTableEntries(params); ///***************************************** // ADD YOUR CODE BELOW //*****************************************/ var query = { "filters": { "fieldName": "ID", "type": "EQ", "value": partID } //partID is an input }; var idQuery = { t: itPartInfo /* INFOTABLE */, query: query /* QUERY */ }; //// result: INFOTABLE var result = Resources["InfoTableFunctions"].Query(idQuery); So this code will return an item in an infotable(thingworx) which is basically an array of objects, it can also be thought of as a table where the array entries are rows and the object properties of each object in the array are the columns. So currently my output is displaying what I have correctly, I need to know how I could display say partID, Color, and MaterialType, my thinking was a I could use a sort function like var sort = new Object(); sort.name = Color; sort.ascending = True; itPartInfo.Sort(sort); But I am getting errors. Any suggestions?
  9. Hi! Im trying to add a function that gives the text in my code a random background color (either yellow, red or green). I want this random color change to happen when I press the button. Can anyone help me with this? my code sofar is: <!DOCTYPE html> <html> <body> <p id="output_paragraph">Click the button to change the text in this paragraph.</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { document.getElementById("output_paragraph").innerHTML = "Hello World"; } </script> </body> </html>
  10. I am unable to display Date and Time on clicking button. Sublime Text image is attached
  11. The example of the AutoComplete Textbox on W3Schools does not work when as entry has an apostrophe in it. It populates the textbox with the characters before the apostrophe but not after. This is a bug. How do you fix this issue? To reproduce this issue, go to the following link. https://www.w3schools.com/howto/howto_js_autocomplete.asp Type in the text box the letter T and try to select "Timor L'Este Thanks
  12. Hi all, I am trying to work with tabs and using the How to Create Tabs page on the w3 site below. I am unclear on one part. In the HTML code, what is the event parameter referring to in the onclick function. I've copied on of the relevant lines below. If someone could elaborate further it would be much appreciated. <button class="tablinks" onclick="openCity(event, 'London')">London</button> https://www.w3schools.com/howto/howto_js_tabs.asp
  13. Hi everyone, I'm still learning, but getting deeper now. I'm trying to use JavaScript and PHP in one page in website. I'm trying to make a switch video source on html by click on button. I believe I'm doing right in PHP, but Javascript seem something is missing. I don't understand how it gone work...it said undefined. <!doctype html> <html> <head> <link href="css/grammar.css" rel="stylesheet" type="text/css"> <link rel="icon" href="images/sigma.png"> <script type="text/javascript" src="js/checkbox.js"></script> <script> function clickvideo() { let path = document.getElementById("video1").button; document.getElementById("display").innerHTML = "<video width='450' controls style='border-radius: 5px;' height='240' type='mp4'>" + "<source src='UPLOADS/Breakfast/" + path + "'></video>"; } </script> </head> <body> <table class="table"> <tr><td><video width="450" controls style="border-radius: 5px;"><source src="video/Ha_Demo.mp4"></video></td></tr> <tr><td> <div id='display'><video width='450' controls style='border-radius: 5px;'><source src="UPLOADS/Breakfast/hello.mp4"></video></div></td></tr> <tr><td> <?php $video = opendir("UPLOADS/Breakfast/"); while(($listvideo = readdir($video)) !== FALSE) { if(preg_match("/^[^\.].*$/", $listvideo)) { echo "<button id='video1' onclick='clickvideo()'>".$listvideo."</button>&nbsp;"; } } ?> </td></tr> </body> </html>
  14. In this case, Let's take Google Search as example:The code is JScript .NET, which is basically a .NET version of Javascript. Regardless of language, Anyone with appending type of skill can answer my question.This code is used in Fiddler(It's a Man-in-the-middle proxy) if (oSession.uriContains("&q=")) // oSession is a Fiddler object session // uriContains() function, checks for case-insensitive string from the URI{ var str = oSession.fullUrl; var sAppend = "test1+test2+test3"; if (!oSession.uriContains(sAppend)) { oSession.fullUrl = str.replace( "&q=","&q="+sAppend); }} For those who are confused, It says, If &q= is present in the URI, replace &q= with &q=test1+test2+test3Problem: It appends test1+test2+test3 instantly, when it sees &q= in the URL.Basically, how do I make it wait until I click the submit/search buttonThank you.Update: I heard about Onsubmit() event, but not really familiar with it. How do I use it? like, should I go to google source page and edit the form id?Also, Any other methods besides Onsubmit()?
  15. we are opening multiple browser child windows using window.showmodellessdialog() method - Is there any way to get z-Index of this window w.r.t. parent window? window.style.zIndex gives null or undefined. I need Z-Index to maintain overlapping order of these windows. Regards, Shwetank
×
×
  • Create New...