Jump to content

Search the Community

Showing results for tags 'function'.

  • 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

  1. Dear everyone, As a beginner, I continue to have trouble understanding the practical utility of the id-selector. Some arguments I see given in favour of the id-selector are as follows: > Specificity: I understand id-selectors have the highest specificity, which can be useful if one wants to ensure a certain class is not overridden. But I have difficulty imagining a scenario in which this would be a true problem. If a coder overrides his own classes, does this not simply mean his code is not in order? When he overrides his own styling, at least he is alerted he needs to correct his code. In this sense, I cannot see a true utility to the id-selector; it seems but to enable sloppy code, which might produce more complicated problems later on as one's project grows more complex. No offence intended, of course. > Targeting Unique Elements: To my understanding, a given id-selector class can be applied only once to a single instance of an html-element. I don't see a reason why one would not just create a unique class for a respective single element with its own unique and respective styling needs. I can, however, imagine the unique syntax of the id-selector makes it more perceivable and standout in a stylesheet, adding to readability. However, one can easily suggest alternatives such as applying comments, or using comments to categorise a group of classes. I personally cannot see the id-selector's role here to be thus meritorious to warrant its existence. > JavaScript Interaction: JavaScript can work and manipulate ids, but it can manipulate and interact with classes just as easily. Is there truly a difference in what JavaScript can do with ids (in terms of CSS/styling) in comparison to what it can do with classes? I would be most grateful if anyone can show me the practical utility of the id-selector. I continue to feel it has no true practical discerning utility compared to the class-selector, which likely indicates I have simply not understood its role properly. I have had this question for a long time, asked here and there, but could never be truly answered. Sincerely, silverRainfall
  2. I read, with great interest, about using a button to show and hide text here. However, I have several blocks of text for which I would like a button to toggle show/hide but would prefer not to duplicate the same function several times. I would like to pass the div ID as a parameter so that multiple buttons may use the same function to show/hide the text associated with each button. I tried the following code but it does not work. <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> #myDIV { width: 100%; padding: 50px 0; text-align: center; background-color: lightblue; margin-top: 20px; } </style> </head> <body> <p>Click the "Try it" button to toggle between hiding and showing the DIV element:</p> <button onclick="myFunction('myDIV')">Try it</button> <div id="myDIV"> This is my DIV element. </div> <p><b>Note:</b> The element will not take up any space when the display property set to "none".</p> <script> function myFunction(myDiv) { var x = document.getElementById(myDIV); if (x.style.display === "none") { x.style.display = "block"; } else { x.style.display = "none"; } } </script> </body> </html>
  3. 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>
  4. Hello. I'd just like to enquire, what is the best way to encrypt and decrypt please? I've created a basic signup form, and I would like to encrypt the data before it's written to a database. Then when I come to create the log in screen, I would like to access the database, pull a record, then decrypt the email and password, to check it matches what the user has entered. Or is there an easier way? Thank You. ps. Also could I please just ask. I've created a function for something else. When I've finished with it, can I delete or destroy it? Thanks.
  5. BACKGROUND I have created two functions both of which have been tested and function as expected -- so well, in fact, that one of them can be used to enhance the output of the other. The problem arises when I seek to call these functions with separate button alerts provided below in the order given. Both functions are defined in a jQuery ready statement. BUTTON ALERTS <script> var num = 5; </script> <button onclick="alert(num.annotate('sec'));">Alert!</button> <script> var sec_num = 59039; </script> <button onclick="alert(secTranslate(sec_num));">Alert!</button> DILEMMA: Although the first button-alert works, the second fails with the following error message: "ReferenceError: secTranslate is not defined." with a reference to the onclick attribute. QUESTION: How does one explain this phenomenon? Roddy
  6. Ok bare with me because I have no idea what this is actually called. If someone knows I will update the title. I am working on a site that will act as an out-of-game marketplace for in-game items. I want to ensure that the player is within the zone of the market in-game so I need an easy way to generate an array of valid coordinates the player could be within to access the market. Ideally i would like to run a function with a parameter specifying the radius of a square and another of the player's current geoID. Basic geometry would help if the geoID's were, in my mind, easier to predict. here is problem: Going North: geoID's increase by 512 points Going East: geoID's increase by 1 Going South: geoID's decrease by 512 Going West geoID's decrease by 1 I realize this is more of a math question then PHP but I have no idea where to start to account for the odd increase. //Generate the exchangeArea array of a 5x5 square around the centeral id specified in param2. $exchangeArea = getExchangeArea(3,117053149); //if player geoID equals one of the values in the exchangeArea array return true else false function getExchangeArea(int radius, int geoID) { . . . } I have attached a graphic showing all the geoIDs for the above example. Ignore the geoAlt that is just they players Y axis. So there is no confusion, North on this diagram is the right side of the image. Making the top West. Any help on where to begin, even if its helping me identify keywords to search on for this kind of formula, algorithm, equation... what ever it's called, would be greatly appreciated.
  7. hey specialists, i spent 2 days on a small java-calulating script for my 7 year old son, to "play on the tablet" :-). At the moment he is not allowed to play games, so he can practice math a little bit... i don't use an app, because i like the "challange" and want to learn something too. thats why i startet to try coding. Now i cant go on, the check-button in my script doesn't do anything. My script shows tasks an Operators, but the entered solution is not going to be compared with the result. Can someone help me to find the error? Script in action is here: http://holland-nell.net/php/java-rechnen.html the Code was written easily in "german". i translated the comments in english... Thanks :-) <!DOCTYPE html> <html lang="de"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=2.0"> <title>Titel</title> <style> #box { width:400px; } </style> <script> var min = 5, max = 10; var richtig = 0, falsch = 0; function hilfe() { /* show result in red */ document.getElementById("erg-output").style.color = "red"; /* Using Help Button is like a not solved task*/ falsch++; document.getElementById("falsch").innerHTML = falsch; /* Reset Inputfield */ document.ergebnis.ergebnis_eingabe.value =""; /* neue Aufgabe nach 1,5 Sekunden */ sleep(1500); aufgabe_erstellen(min,max); } function sleep(milliseconds) { var start = new Date().getTime(); for (var i = 0; i < 1e7; i++) { if ((new Date().getTime() - start) > milliseconds){ break; } } } function compare () { /* compare entered and calculated value */ var erg_eingabe = (document.ergebnis.ergebnis_eingabe.value); var erg =(document.getElementById("erg-output").value); console.log('Ergebnis Eingabe: ' + erg_eingabe + ' berechnetes Ergebnis: ' + erg); if (erg == erg_eingabe) { alert("richtig"); document.ergebnis.ergebnis_eingabe.value =""; richtig++; document.getElementById("richtig").innerHTML = richtig; } else { alert("falsch"); falsch++; document.getElementById("falsch").innerHTML = falsch; } } function aufgabe_erstellen(min, max) { /* show result in white */ document.getElementById("erg-output").style.color = "white"; /* if input empty create new task */ if(document.ergebnis.ergebnis_eingabe.value == '') { zahl1 = Math.floor(Math.random() * (max - min +1)) + min; zahl2 = Math.floor(Math.random() * (max - min +1)) + min; /* check which operation is activeted */ var op =''; for (var i = 0; i < 4; i++) { if(document.operatoren.op[i].checked) { op = (document.operatoren.op[i].value); break; } } /* Create a String to show in div-element */ var aufgabe = zahl1 + ' ' + op + ' ' + zahl2; eval(aufgabe); /* Calc results */ switch (op) { case '+': var erg = zahl1 + zahl2; break; case '-': erg = zahl1 - zahl2; break; case '*': erg = zahl1 * zahl2; break; case '/': erg = zahl1 / zahl2; break; default: erg = ''; } /* Show task and result (in white) */ document.getElementById("aufgabe").innerHTML = aufgabe + " = "; document.getElementById("erg-output").innerHTML = erg; /* if inputfield not empty call function "compare" */ } else { compare(); } } </script> </head> <body> <div id="box"> <div class=""> <form name="operatoren" onchange="aufgabe_erstellen(min,max)"> <input type="radio" name="op" value="-">Minus</input> <input type="radio" name="op" value="+">Plus</input> <input type="radio" name="op" value="*">Multiplikation</input> <input type="radio" name="op" value="/">Division</input> </form> <div id="aufgabe"></div><div id="erg-output"></div> </div> <div class=""> <form name="ergebnis"> <input type="number" name="ergebnis_eingabe" /> </form> <button onklick="compare()">Check</button> </div> <div> <button onclick="hilfe()">Hilfe?</button><br> Richtig: <div id="richtig">0</div> Falsch: <div id="falsch">0</div> </div> </div> </body> </html>
  8. Woocommerce took out the option for enabling a lightbox feature for your image gallery earlier this year. They have in their documentation to add code if you want to enable the gallery features but don’t actually say where. https://woocommerce.wordpress.com/2017/02/28/adding-support-for-woocommerce-2-7s-new-gallery-feature-to-your-theme/ This is a significant frontend change that can be broken down in to three separate new features; Image zoom / magnification Lightbox Slider To enable each of these features in your theme you must declare support using add_theme_support() like so; 1 2 3 4 5 6 7 add_action( 'after_setup_theme', 'yourtheme_setup' ); function yourtheme_setup() { add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); } This allows you the flexibility to pick and choose exactly which features you want to include/exclude in your theme or at your store. I am not a developer, I don’t have a developer (and shame on WC for not making this an option that end users can opt for or not without having to add code!) I need to know where to put this code. I am using a child theme called mystile1. I have files called “Theme Functions (function.php)” and one called “custom.css” that’s says it is specifically for adding code to modify my child theme styles. I don’t know which file I should put the above coding in and where. Nowhere does each of these files have a line called “after_setup_theme” So would I be safe in just adding the code as follows in one of those files (which one?) replacing “yourtheme” with the name of my theme: add_action( 'after_setup_theme', 'mystile1_setup' ); function mystile1_setup() { add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); } Or any other suggestions are greatly appreciated. Thank you.
  9. So I am working on a simple client database type program. I have a clients array that stores new clients that all have a first name, last name, phone number, etc... I also want the user to be able to add notes about their clients' family. So, one of the parameters of the client function is an array called familyNotes. Here is the code for this: function client(firstName, lastName, phoneNumber, address, hireDate, frequency, cost, entry, familyNotes) { this.firstName = firstName; this.lastName = lastName; this.phoneNumber = phoneNumber; this.address = address; this.hireDate = hireDate; this.frequency = frequency; this.cost = cost; this.entry = entry; this.familyNotes - familyNotes; } var laura = new client("laura", "simmerman", "1111111111", "laura rd", "01/01/01", "weekly", "100", "garage-1111"); var jana = new client("jana", "simmerman", "2222222222", "jana rd", "01/01/01", "weekly", "100", "garage-2222"); var clients = [laura, jana]; However, I do not know if the familyNotes array is working properly. I have a function that prompts the user to add a note about the family of a client, then adds the note to the array. Here is the code for this function: function addFamilyNotes(i) { var note = prompt("Add a note about the family: "); document.getElementById("familyNotes").innerHTML += "<li>" + note + "</li>"; clients[i].familyNotes.push(note); } I later have a function that is supposed to alert the length of the familyNotes array, however it doesn't alert anything currently. Here is the code: function familyNotesAlert(i) { alert(clients[i].familyNotes.length); } Does anyone know what I am doing wrong? Why is the alert not showing, and is anything actually being added to the familyNotes array?
  10. I've got a function that create mesh when you click on another. On the click, 2 or 3 mesh are created and go to their positions. Know i would like to do the reverse function : when the mesh are deployed, and you click anoter time on the mesh, the previously created mesh go back and are removed from the scene. Here is my first function : function sortiSphere(element, obj) { var matStdParams = { roughness: 1, metalness: 0.8, color: element.group, emissive: element.group, emissiveIntensity: 0.5 }; var sphereMaterial2 = new THREE.MeshStandardMaterial(matStdParams); var mesh = new THREE.Mesh(sphereGeometry, sphereMaterial2); mesh.position.x = x; mesh.position.y = y; mesh.position.z = z; mesh.userData.children = element.children; mesh.userData.name = element.label; mesh.userData.rang = element.rang; mesh.userData.def = element.définition; mesh.userData.posx = element.posx; mesh.userData.posy = element.posy; mesh.userData.posz = element.posz; mesh.userData.parent = obj; mesh.userData.cartabs = element.cartabs; mesh.position.normalize(); mesh.position.multiplyScalar(1 / element.rang); mesh.scale.set(1 / (element.rang / 2), 1 / (element.rang / 2), 1 / (element.rang / 2)) mesh.position.x = obj.position.x; mesh.position.y = obj.position.y; mesh.position.z = obj.position.z; var x = element.posx; var y = element.posy; var z = element.posz; new TWEEN.Tween(mesh.position).to({ x: x, y: y, z: z }, 1000) .easing(TWEEN.Easing.Elastic.Out).start(); console.log(mesh); scene.add(mesh); lesMesh.push(mesh) // lines var material = new THREE.LineBasicMaterial({ color: 0xffffff }); var geometry = new THREE.Geometry(); geometry.vertices.push( obj.position, new THREE.Vector3(x, y, z) ); var line = new THREE.Line(geometry, material); scene.add(line); gen1 = []; gen2 = []; gen3 = []; gen4 = []; gen5 = []; obj.userData.bool = true; }; Notice that the mesh contain a information about their state : userData.bool (true if deployed, false if not) Now, how do I tell them to go back ? Here is what I got for now : function deleteSphere(element, obj) { console.log("--- deleteSphere / debut fonction") for (i = 0; gen1.length > i; i++) { if (gen1[i].userData.children) { for (j = 0; gen1[i].userData.children.length > j; j++) { console.log(gen2[i][j]); scene.remove(gen2[i][j]);} } else { scene.remove(gen1[i]) console.log(gen1[i].userData.children) } } }; Thanks for your time
  11. Sorry people here I have asked this before, so its a bit embarassing to me. But .... I have the following question. Its about using a function inside an if condition. The thing is that when I make a function with 2 returns in this case $data and $alternative I receive them both back. I ask this for grasping how a function acts inside an if condition. So my question is: how does the php engine ‘reason’? Is the outcome of the return ONLY POSSIBLE if you return 1 value inside an if condition; so either true or false ? Example: <?php function valid_someting($data){ global $alternative; $count=''; $count = strlen($data); if ( ($count < 8 && ($count > 4) ) ) { $data = preg_replace('/[^a-zA-Z0-9!@#$%^&*()\-_=+{};:,<.>]/', '', $data ); // $data = ltrim($data); $data = rtrim($data); return $data; } $alternative = $data; return $alternative; } $data = 'abcdabcdabcd'; if (valid_someting($data)) { echo 'color input field green'; } else if ($alternative == TRUE) { echo 'color input field RED'; } ?>
  12. Hi All, I'm looking for a solution in using a function. The function fetches data from a database. In a column multiple results are found. I want to have all the records outisde the function. Inside the function all records are shown, but outside only the last record. I thought I could use return array, but it only returns multiple variables and not multiple rows. Not sure if fetch() is the solution for arrays. example: <?php function test_func($val4) { global $val1; global $val2; global $val4; $servername = "host"; $username = "johndoe"; $password = "admin"; $dbname = "dbase_db"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // if ($stmt = $conn->prepare("SELECT col1, col2 FROM table WHERE col4 = ? ; ")) { $stmt->bind_param("s", $val4); $stmt->execute(); $stmt->store_result(); $num_of_rows = $stmt->num_rows; var_dump($num_of_rows); $stmt->bind_result($val1, $val2); if ($num_of_rows > 0){ while ($stmt->fetch()) { // managed to output multiple rows here, but that's not the goal } return array ($val1, $val2); } } } $val4='form_value'; test_func($val4); // return multiple rows here, outside the function How should I solve this?
  13. Hi, here is a code. I want to make the .characteristics-quote to stay fixed when scrolling to the .characteristics-wrapper. But When the characteristics-wrapper class scrolling is finished the .characteristics-quote should be vanished. Can you please tell me how I can fix this ? Thank you in advance. <!DOCTYPE html> <html lang= "en-us"> <head> <meta charset= "utf-8"/> <title>About</title> <link rel= "stylesheet" type= "text/css" href= "font-awesome-4.7.0/css/font-awesome.min.css"/> <style type= "text/css"> body { margin: 0; padding: 0; color: white; background-color: black; overflow: auto; } .about { max-width: 100%; height: 200px; background-color: black; color: white; text-align: center; padding-left: 10%; padding-right: 10%; padding-top: 5px; margin: 0; } .characteristics-wrapper { max-width: 100%; padding: 10px; margin-bottom: 200px; border: 1px solid white; overflow: hidden; } .characteristics-quote { max-width: 40%; float: left; transform: translateX(-5%); position: fixed; color: white; } .characteristics-quote h1 { max-width: 70%; text-align: center; margin: auto; padding-top: 100px; } .characteristics-container { max-width: 60%; float: right; text-align: center; position: relative; } .characteristics-item-row1, .characteristics-item-row2 { max-width: 50%; } .characteristics-item-row1 { padding-top: 50px; } .characteristics-item-row2 { position: absolute; top:50px; right: 0; } .characteristics-item { max-width: 80%; display: block; margin: auto; margin-bottom: 20px; margin-top: 20px; } .characteristics-icon { font-size: 60px; padding: 15px; border: 1px solid lightgrey; border-radius: 50%; height: 76px; width: 76px; margin: auto; } .characteristics-item:hover .characteristics-icon{ background-color: white; color: black; -webkit-transition: 0.6s ease-in-out; -moz-transition: 0.6s ease-in-out; -ms-transition: 0.6s ease-in-out; -o-transition: 0.6s ease-in-out; transition: 0.6s ease-in-out; } /**Animations**/ .left { -webkit-animation-name: left; -webkit-animation-duration: 1s; -moz-animation-name: left; -moz-animation-duration: 1s; -ms-animation-name: left; -ms-animation-duration: 1s; -o-animation-name: left; -o-animation-duration: 1s; animation-name: left; animation-duration: 1s; } .right { -webkit-animation-name: right; -webkit-animation-duration: 3s; -moz-animation-name: right; -moz-animation-duration: 3s; -ms-animation-name: rightt; -ms-animation-duration: 3s; -o-animation-name: right; -o-animation-duration: 3s; animation-name: right; animation-duration: 3s; } .scale { -webkit-animation-name: scale; -webkit-animation-duration: 2s; -moz-animation-name: fade; -moz-animation-duration: 2s; -ms-animation-name: scale; -ms-animation-duration: 2s; -o-animation-name: scale; -o-animation-duration: 2s; animation-name: scale; animation-duration: 2s; } .fade { -webkit-animation-name: fade; -webkit-animation-duration: 2s; -moz-animation-name: fade; -moz-animation-duration: 2s; -ms-animation-name: fade; -ms-animation-duration: 2s; -o-animation-name: fade; -o-animation-duration: 2s; animation-name: fade; animation-duration: 2s; } /**Animating from the left**/ @-webkit-keyframes left { from {left: -500px;} to {left: 0;} } @-moz-keyframes left { from {left: -500px;} to {left: 0;} } @-ms-keyframes left { from {left: -500px;} to {left: 0;} } @-o-keyframes left { from {left: -500px;} to {left: 0;} } @keyframes left { from {left: -500px;} to {left: 0;} } /**Animating from the right**/ @-webkit-keyframes right { from {right: -500px;} to {right: 0;} } @-moz-keyframes right { from {right: -500px;} to {right: 0;} } @-ms-keyframes right { from {right: -500px;} to {right: 0;} } @-o-keyframes right { from {right: -500px;} to {right: 0;} } @keyframes right { from {right: -500px;} to {right: 0;} } /**Animating scale**/ @-webkit-keyframes scale { from {transform: scale(3);} to {transform: scale(1);} }@-moz-keyframes scale { from {transform: scale(3);} to {transform: scale(1);} }@-ms-keyframes scale { from {transform: scale(3);} to {transform: scale(1);} }@-o-keyframes scale { from {transform: scale(3);} to {transform: scale(1);} } @keyframes scale { from {transform: scale(3);} to {transform: scale(1);} } /**Fading animation**/ @-webkit-keyframes fade { from {opacity: 0;} to {opacity: 1;} } @-moz-keyframes fade { from {opacity: 0;} to {opacity: 1;} } @-ms-keyframes fade { from {opacity: 0;} to {opacity: 1;} } @-o-keyframes fade { from {opacity: 0;} to {opacity: 1;} } @keyframes fade { from {opacity: 0;} to {opacity: 1;} } </style> </head> <body> <div class= "about"> <h1>Who we are?</h1> <div class= "about-content">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam accumsan sed leo eget malesuada. Integer dapibus nisi id eros scelerisque accumsan. Pellentesque commodo, enim nec faucibus tristique, risus nibh ullamcorper velit, sed egestas urna erat sit amet justo.</div> </div> <div class= "characteristics-wrapper"> <div class= "characteristics-quote"> <h1>Main characteristics of our services</h1> </div> <div class= "characteristics-container"> <div class= "characteristics-item-row1"> <div class= "characteristics-item"> <div class= "characteristics-icon"><i class="fa fa-pagelines" aria-hidden="true"></i></div> <div class= "characteristics-title">Innovative</div> <div class= "characteristics-description">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam accumsan sed leo eget malesuada. Integer dapibus nisi id eros scelerisque accumsan.</div> </div> <div class= "characteristics-item"> <div class= "characteristics-icon"><i class="fa fa-cogs" aria-hidden="true"></i></div> <div class= "characteristics-title">Great Features</div> <div class= "characteristics-description">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam accumsan sed leo eget malesuada. Integer dapibus nisi id eros scelerisque accumsan.</div> </div> <div class= "characteristics-item"> <div class= "characteristics-icon"><i class="fa fa-modx" aria-hidden="true"></i></div> <div class= "characteristics-title">Unique Design</div> <div class= "characteristics-description">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam accumsan sed leo eget malesuada. Integer dapibus nisi id eros scelerisque accumsan.</div> </div> <div class= "characteristics-item"> <div class= "characteristics-icon"><i class="fa fa-graduation-cap" aria-hidden="true"></i></div> <div class= "characteristics-title">Well Documented</div> <div class= "characteristics-description">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam accumsan sed leo eget malesuada. Integer dapibus nisi id eros scelerisque accumsan.</div> </div> </div> <div class= "characteristics-item-row2"> <div class= "characteristics-item"> <div class= "characteristics-icon"><i class="fa fa-pagelines" aria-hidden="true"></i></div> <div class= "characteristics-title">Innovative</div> <div class= "characteristics-description">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam accumsan sed leo eget malesuada. Integer dapibus nisi id eros scelerisque accumsan.</div> </div> <div class= "characteristics-item"> <div class= "characteristics-icon"><i class="fa fa-cogs" aria-hidden="true"></i></div> <div class= "characteristics-title">Great Features</div> <div class= "characteristics-description">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam accumsan sed leo eget malesuada. Integer dapibus nisi id eros scelerisque accumsan.</div> </div> <div class= "characteristics-item item2"> <div class= "characteristics-icon"><i class="fa fa-modx" aria-hidden="true"></i></div> <div class= "characteristics-title">Unique Design</div> <div class= "characteristics-description">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam accumsan sed leo eget malesuada. Integer dapibus nisi id eros scelerisque accumsan.</div> </div> <div class= "characteristics-item"> <div class= "characteristics-icon"><i class="fa fa-graduation-cap" aria-hidden="true"></i></div> <div class= "characteristics-title">Well Documented</div> <div class= "characteristics-description">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam accumsan sed leo eget malesuada. Integer dapibus nisi id eros scelerisque accumsan.</div> </div> </div> </div> </div> <div style= "height: 700px"></div> </body> </html>
  14. Hi, I want to change the background image automatically every 5 second and the indicators should be green. I followed w3schools slideshow tutorial and created this slideshow. But it doesn't seem to work as expectation. Please tell me where I made the mistake. thank you in advance. <!DOCTYPE html> <html> <head> <style> body { margin: 0; padding: 0; } .header-slideshow-container { width: 100%; margin: 0; padding: 0; } .header-slide { display: block; width: 100%; height: 100%; margin: 0; padding: 0; } #header-slide1 { background-image: url("http://www.w3schools.com/howto/img_nature_wide.jpg"); background-repeat: no-repeat; background-attachment: fixed; background-size: 100% 100%; } #header-slide2 { background-image: url("http://www.w3schools.com/howto/img_fjords_wide.jpg"); background-repeat: no-repeat; background-attachment: fixed; background-size: 100% 100%; } #header-slide3 { background-image: url("http://www.w3schools.com/howto/img_mountains_wide.jpg"); background-repeat: no-repeat; background-attachment: fixed; background-size: 100% 100%; } .current-header-slides-container { position: absolute; top: 45%; right: 25px; margin-top: -30px; } .current-header-slide-indicator { width: 15px; height: 15px; border-radius: 50%; margin-bottom: 5px; background-color: black; } </style> </head> <body> <div class= "header-slideshow-container"> <div class= "header-slide" id= "header-slide1"></div> <div class= "header-slide" id= "header-slide2"></div> <div class= "header-slide" id= "header-slide3"></div> <div class= "current-header-slides-container"> <div class= "current-header-slide-indicator"></div> <div class= "current-header-slide-indicator"></div> <div class= "current-header-slide-indicator"></div> </div> </div> <script> var h = window.innerHeight; (function () { 'use strict'; document.getElementsByClassName("header-slideshow-container")[0].style.height = h + 'px'; }()); var headerSlideIndex = 0; headerSlideshow(); function headerSlideshow() { 'use strict'; var i, headerSlides = document.getElementsByClassName("header-slide"), dots = document.getElementsByClassName("current-header-slide-indicator"); for (i = 0; i < headerSlides.length; i++) { headerSlides[i].style.display = "none"; } headerSlideIndex++; if (headerSlideIndex >= headerSlides.length) { headerSlideIndex = 1; } for (i = 0; i < dots.length; i++) { dots[i].style.backgroundColor = "black"; } headerSlides[i-1].style.display = "block"; dots[i-1].style.backgroundColor = "green"; setTimeout(headerSlideshow, 5000); } </script> </body> </html>
  15. Hi,I am developing my first website template. When I used this script in the internal script, it ran well. But when I added this script inside a file,the jsLint showed that there was almost 20 errors. Here I am sending the screen of the errors. Can you please help me to understand why these errors occurred and how can I resolve these? Here is the script: function openModalSearch() { 'use strict'; var modalSearch = document.getElementById("modal-search-container"); modalSearch.style.height = "100%"; } function closeModalSearch() { 'use strict'; document.getElementById("modal-search-container").style.height = "0%"; } function hideSearch() { 'use strict'; document.getElementById("search-container").style.visibility = "hidden"; } function showSearch(){ 'use strict' document.getElementById("search-container").style.visibility = "visible"; } Thank you in advance......
  16. var xmlhttp; var Staff, obj; var url = "staff.json"; function init() { xmlhttp = (window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP") ? new ActiveXObject("Msxml2.XMLHTTP") : null ; xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { Staff = JSON.parse(this.responseText); var table = document.createElement("table"); document.body.appendChild(table); obj = Staff.Staff[0]; for (var y in obj) { var header_row = document.createElement("th"); var column = document.createElement("td"); var data = document.createTextNode(y); column.appendChild(data); header_row.appendChild(column); table.appendChild(header_row); } for(var x=0; x<Staff.Staff.length; x++) { obj = Staff.Staff[x]; if (x%2 == 0) { var row = document.createElement("tr"); row.setAttribute("class","even"); // function? for (var y in obj) { var column = document.createElement("td"); var data = document.createTextNode(obj[y]); column.appendChild(data); row.appendChild(column); table.appendChild(row); } } else { var row = document.createElement("tr"); // function? for (var y in obj) { var column = document.createElement("td"); var data = document.createTextNode(obj[y]); column.appendChild(data); row.appendChild(column); table.appendChild(row); } } } } }; xmlhttp.open("GET",url,true); xmlhttp.send(); } window.onload = init; Since the codes below "// function?" are repeated (either the row to be created in the JavaScript is odd or even), how can I write the same codes into ONE function to be shared and used in different places? Thanks for any help!
  17. Hi, I am facing problem to undestand the showSlides() function . Can you please explain this function to me . var slideIndex = 1; showSlides(slideIndex); function plusSlides(n) { showSlides(slideIndex += n); } function currentSlide(n) { showSlides(slideIndex = n); } function showSlides(n) { var i; var slides = document.getElementsByClassName("mySlides"); var dots = document.getElementsByClassName("dot"); if (n > slides.length) {slideIndex = 1} if (n < 1) {slideIndex = slides.length} for (i = 0; i < slides.length; i++) { slides[i].style.display = "none"; } for (i = 0; i < dots.length; i++) { dots[i].className = dots[i].className.replace(" active", ""); } slides[slideIndex-1].style.display = "block"; dots[slideIndex-1].className += " active"; }
  18. Hello, I found a function called fnGetSibling on https://msdn.microsoft.com/en-us/library/ms533043(v=vs.85).aspx#navigate and I was hoping to understand what it does return and why. var oPrevious = fnGetSibling(); function fnGetSibling(){ var oParent=oNode.parentElement; var iLength=oParent.children.length; for(var i=0;i < iLength;i++){ if(oParent.children[i]==oNode){ return oParent.children[i - 1]; break; } } } I have three possible options: 1. Finds and returns a reference to all childs of a node of DOM Tree. 2. Finds and returns a reference to one of the children of a node of DOM Tree. 3. Finds and returns a reference to a father of a node of DOM Tree. You are not solving any homework (it's summer), it's just from a quiz.
  19. Hello everybody, I've got a little problem that I cannot get working. Hope you experts here could help me out with this. I found this hamburger menu animation by Jonsuh: https://jonsuh.com/hamburgers That thing is really nice. Now I want to trigger the animation on hover instead of click. I'd like to hover another item (e.g. 'code') and trigger the animation. Hovering 'code' would start animation and leaving the item would transform hamburger back. I tried it with the mouseover/mouseout function.... but don't know how to get this working with hamburger. I'd really appreciate every help and info. Thanks in advance!
  20. Hi guys! I have a little problem and it's that I get an error in a determined function where I call my connection and I don't know why. The errors are: 1) Notice: Undefined variable: conexionidiomas in C:\wamp64\www\idiomas\preguntas-frecuentes.php on line 10 2) Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, null given in C:\wamp64\www\idiomas\preguntas-frecuentes.php on line 11 This is what I have from "/Connections/conexionidiomas.php": # FileName="Connection_php_mysql.htm" # Type="MYSQL" # HTTP="true" $hostname_conexionidiomas = "p:localhost:3307"; $database_conexionidiomas = "idiomasbd"; $username_conexionidiomas = "root"; $password_conexionidiomas = "asdasdf"; $conexionidiomas = mysqli_connect($hostname_conexionidiomas, $username_conexionidiomas, $password_conexionidiomas, $database_conexionidiomas); and this in "preguntas-frecuentes.php": <?php require_once('Connections/conexionidiomas.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysqli_real_escape_string") ? mysqli_real_escape_string($conexionidiomas, $theValue) : mysqli_escape_string($conexionidiomas,$theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO tblfrecuentes (strPregunta,fchFecha) VALUES (%s,NOW())",GetSQLValueString($_POST['strPregunta'], "text")); $Result1 = mysqli_query($conexionidiomas,$insertSQL) or die(mysqli_error($conexionidiomas)); } ?> So, if someone could help me I'd appreciate it so much. Regards!
  21. Hello & Thanks , I am learning from this example : http://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_ev_onclick I want to put the .js in a separate file , <script src="skel-main-2.js"></script> instead of within the .html . Code is here : quick.js: www.liesandcowpies.com/testMe/Quickjs/quick.js (if needed) html: http://pastebin.com/EQUTDd4y js: pastebin.com/HXbrb86M I want to put the .js in a separate file , <script src="skel-main-2.js"></script> instead of within the .html . But when I run it , up comes this console error : Uncaught ReferenceError: myFunction is not defined ? How can I connect .html with .js ? Thanks
  22. Down here the code to call a function it works with list. I dont understand how list works, In my example list gives a survey of 2 arrays that are executed inside the function here is how I call the function: $row = list ($variable, $number) = my_function(); var_dump($row); the output is like this: I need the values separated but how can I list the second array (the one with the numbers) as single numbers outside an own function?
  23. Hello, while reading the tutorial about js i found this paragraph: According to Stack Overflow fullName is not a function, because the result depends on the state of the object and is not always the same. Maybe you need to correct this or be more precise with your definition of a function.
  24. j.silver

    Notice Error

    Dear all: I have the following php line of code: <?php $var2 = 5; ?> += : <?php $var2 += 4; echo var2; ?><br /> Because of the lack of the dollar sign before var2 following the echo, it spat out the following error: += : Notice: Use of undefined constant var2 - assumed 'var2' in C:xampphtdocsTutorialsPHPw3schoolsintegers.php on line 29var2 My understanding prior to this was that Notice means something bad in the code but it is not an error and would not stop the code from executing. But the code has not executed in this example. Since the code is not executing, I am not seeing the real difference between Notice and other forms of errors that prevent codes from executing. Any clarification please?
×
×
  • Create New...