Jump to content

Search the Community

Showing results for tags 'javascript'.

  • 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. BACKGROUND: Recently I discovered a nifty Javascript function that counts the like values of an index array and returns as its value an object whose property-value pairs consist of a single repeated value and its corresponding frequency. Unfortunately, I am having trouble understanding how the function works. As I have adapted it to fit my own needs I have changed the variable names. Indeed, this change may be the source of my own confusion. The FUNCTION: function dateCounter(dates) { return dates.reduce( (countDates, date) => { countDates[date] = ++countDates[date] || 1; return countDates; }, {} ); } REQUEST: Please write in plain English what the so-called reducer function of the reduce( ) function is achieving with each iteration. I am baffled. Roddy
  2. I am needing to convert an String input into an Integer. But before converting the String input, i have to do a validation that the String input can be converted to a numeric value. So If it cannot, i need to log a message saying “This cannot”. Then log another new log statement on the next line saying “be a number”. I understand I need a parseInt and isNan and if else statements but I am confused on exactly how they are implemented. I am new to javascript.
  3. I am designing a Sharepoint page with script editor. I have an image which I have used area tag on. So with onmouseover another image pops up and it reverts back onmouseout. I further want to use another area tag on this new image onmouseover where I can add area tags on this new image. Something like a nested image map. For description sake. I will use script from w3schools. <img src="planets.gif" width="145" height="126" alt="Planets" name="myname" usemap="#planetmap"> <map name="planetmap"> <area shape="rect" coords="0,0,82,126" onmouseover=myname.src="C:\Users\Quabynar\Pictures\sun.gif" ; onmouseout=myname.src="C:\Users\Quabynar\Pictures\planets.gif"> <area shape="circle" coords="90,58,3" href="mercur.htm" alt="Mercury"> <area shape="circle" coords="124,58,8" href="venus.htm" alt="Venus"> </map> I expect to put another map with area tags on the sun.gif when onmouseover where I can use href to say a link about description the Sun. I don't seem to get around it.
  4. Hey guys, I know that this is quite a longshot but I hope that there is someone here that can help me. We've had problems with our Store Locator on our homepage for quite a long time since it was missing an API Code (which we got today). The site I'm talking about is this: http://www.melon-helmets.com/en/stores The Problem is: I don't know where to put the API. There is this line of code <script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script> My guess was that I'd have to enter the API key after js?, by adding key=ourkey. It does display the map without an error afterwards, unfortunately it always asks me to enter a zip code or adress, even though I did so. (Tried City/Adress/ZIP Code) Can anyone help me? (I'm fairly poor at html/css/js) Thank you!
  5. I tried including the 'tab.html' and ‘content.html’ into my 'index.html' (using w3school code: how to include HTML, found at: https://www.w3schools.com/howto/howto_html_include.asp), but the javascript and css elements do not work. The buttons don't work as intended. Look at: https://rads-198409.appspot.com If you minimize the browser window, the tab is supposed to change to a drop-down menu, but the button does not work at all. I have checked the individual pages and they seem to work just fine, just not when they are combined. Am I doing something wrong? Could someone help? All the code I used is from w3school and I have only modified the file names (tab.html and content .html to point to the right files). Below are links to the code: Code for ‘tab.html’ - https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_topnav Code for ‘content.html’ - https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_collapsible_symbol Code for ‘index.html’ - https://www.w3schools.com/howto/tryit.asp?filename=tryhow_html_include_2
  6. HI, I'm using RPC.Query to send a string from js to py. At py receptor this scrash using json.loads(..) de args. The messages error is: "" ... JSONDecoderError(\"Expecting value\", s, err.value) from None\njson.decoder.JSONDecodeEror: Expecting value: line 1 colum1 (char 0)\n", "message": "Expecting value: line 1, column 1 (char 0)"], "Exception_type":"internal_error"}}" "" I do an console.log(..) beford RPC instruction and the string value is ok. That is the code: FROM JS: .... // *JCM* var strcontenido = ''; var LF = '\n'; var orderi = JSON.parse(JSON.stringify(order)); var orderf = JSON.parse(JSON.stringify(order_flushed)); strcontenido ="80#DOCUMENTO DE PRUEBA +LF80_is*YO MISMO+LF80_ir*22157456+LF80_i03Dirección: Calle, 12345678 Ciudad, Venezuela+LF80_i04Teléfono: +584161236548+LF80_i05Referencia: 00001-317-0204+LF80_i06Mesa: M5, Comensales: 1+LF80_@*****Gracias por su compra*****+LF80_#000000010000001000Golosinas+LF101" strcontenido= strcontenido.split(":").join("?"); // Replace ":" with "?" to send to py strcontenido= strcontenido.split(",").join("-"); // Replace "," with "-" to send to py console.log(strcontenido); // This show ok errTxt = self._crear_factura( true, strcontenido); var transfer = self._flush_orders([order_flushed], {timeout:30000, to_invoice:true}); // *JCM* // ...do some... }); return done; }); return invoiced; }, // Envia comandos al programa en python- Send command to py _crear_factura: function(imprime, strcontenido) { var self = this; var ejecuted = true; strcontenido = '{"F": "\'' +strcontenido + '\'"}' // Converting string to json inserting {"id": '...string...'} format var args = JSON.parse(strcontenido); console.log('ARGS=>>'+args); // This show text ok >> 80#DOCUMENTO DE PRUEBA +LF80_is*YO MISMO+LF80_ir*22157456+LF80_i03Dirección? Calle- 12345678 Ciudad- Venezuela+LF80_i04Teléfono? +584161236548+LF80_i05Referencia? 00001-317-0204+LF80_i06Mesa? M5- Comensales? 1+LF80_@*****Gracias por su compra*****+LF80_#000000010000001000Propinas+LF101 if (imprime) { return rpc.query({ model: 'pos.order', method: 'print_ticket', args: args, }).fail(function(error, event){ ejecuted = false; }); console.log('_crear_factura (\n' + strcontenido +'\n): Ejecutada...!!!'); } else { console.log('_crear_factura (\n' + strcontenido +'\n): NO EJECUTADA...!!!'); } return ejecuted; }, ... FROM py: @api.model def print_ticket(self, strcontenido): #contenido = strcontenido.get('F') // Error: strcontenido d'nt have get method contenido = json.loads(strcontenido) // Error: previus commented f=open('c:/IntTFHKA/invoiced1.txt','w') #if strcontenido.get('F'): // Error: strcont.... # contenido = strcontenido['strcontenido'] errVal=f.write(contenido["F"]) // Never cross at this... #else: # errVal=f.write('***** GENERAR LA FACTURA*****\n\n') #for data in strcontenido: errVal=f.write(data) errVal=f.write('\n\n*****FIN DEL ARCHIVO******\\nn') errVal = f.close() return True So, I had proved some method without result.... ¿Do you have any idea to resolv...??
  7. Is there anyway to make this dropdown menu use onclick instead of hover on small screens. I'm creating a menubar with several dropdowns and a couple sub-dropdowns with-in them and as it is on small screes the menu is too hard to navigate with the hover. https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_responsive_navbar_dropdown Thanks!
  8. Hi every one, My name is Antoine and I am trying to get all the pictures from a Facebook Page and Instagram Page. I've tried to make a jquery request like $('exemple').load('https://www.facebook.com/pg/stuffedfoxes/photos/ #id'); But it's not working because i don't have any direct id (embedded on the img container). My goal is to get all the 'http' directory of the images and to put them on my web page with my own css code. /* I don't want to use any API*/ Is it possible to load the entire page and filter all the information i need and erased all the others ? /* I'm open to all the solutions excepted if they are using API*/ THANKS PS( sorry for my miss takes im FR ; )
  9. Hi, i love the w3school web, I learn for first time coding here and so im fun because I have job with coding relation. But for React so hard to learn with bad english spech knowledge. So the w3school can added new tutorial about React JS? Thanks..
  10. I have used the script for creating an accordion from w3Schools . I would like to add a button somwhere on the page that would collapse all that are open. Even if it is just a reload of the page which would work. <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.display === "block") { panel.style.display = "none"; } else { panel.style.display = "block"; } }); } </script> Please help. I am definitely a newbie. Linda
  11. Hello, With reference to your "Responsive TopNav" example here: https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_topnav it works fine for the most part, except that when the "hamburger" icon is used it does not close down again after making a selection. I have included my own slightly modified version of your example, simplified so there are only "home" and "news" menu items, and the hamburger icon will appear when reducing the width below 1000px. How can this be modified to collapse the hamburger links upon making a selection? Thanks... Jon <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <style> body { margin: 0; font-family: Arial, Helvetica, sans-serif; } .topnav { overflow: hidden; background-color: #333; position: absolute; left: 0; top: 0; width: 100%; } .topnav a { float: left; display: block; color: #f2f2f2; text-align: center; padding: 14px 16px; text-decoration: none; font-size: 17px; } .topnav a:hover { background-color: #ddd; color: black; } .active { background-color: #4CAF50; color: white; } .topnav .icon { display: none; } @media screen and (max-width: 1000px) { .topnav a:not(:first-child) {display: none;} .topnav a.icon { float: right; display: block; } } @media screen and (max-width: 1000px) { .topnav.responsive {position: relative;} .topnav.responsive .icon { position: absolute; right: 0; top: 0; } .topnav.responsive a { float: none; display: block; text-align: left; } } </style> </head> <body> <div class="topnav" id="myTopnav"> <a href="#home" class="active">Home</a> <a href="#news">News</a> <a href="javascript:void(0);" class="icon" onclick="myFunction()"> <i class="fa fa-bars"></i> </a> </div> <script> function myFunction() { var x = document.getElementById("myTopnav"); if (x.className === "topnav") { x.className += " responsive"; } else { x.className = "topnav"; } } </script> <div style="padding-left:16px; padding-top:40px"> <h2>Responsive Topnav Example</h2> <p>Resize the browser window to see how it works.</p> </div> <h2 id="home">Home</h2> asdf<br> asdf<br> asdf<br> asdf<br> asdf<br> asdf<br> <h2 id="news">News</h2> asdf<br> asdf<br> asdf<br> </body> </html>
  12. Hello everyone, I'm trying to create a RSA encryption, but seem it is not function correctly. Is Javascript know RSA? like, let rsa = new RSA(); do I have to download from github? here my code: let rsa = new RSA(); let prime = ["2", "3", "5", "7", "11", "13"] //<-- Prime number let random = prime[Math.floor(Math.random() * prime.length)]; let text = document.getElementById("readed"); document.getElementById("en").innerHTML = rsa.encrypt(random, text); Seem console log show it is not function.
  13. Hi everyone, I want to make clear again. I am trying to get data from "name" by PHP in HTML, but problem is "name" is used up by Javascript, but I need "name" for PHP's $_POST to get data from input from html, but can I use this "name" by JavaScript and PHP in same time? I need to get data from that word to post in database, but I think I'm stuck now...Anyone can tell me what is alternative keyword to get data from "name" in HTML? If you don't understand what I said, I will display and show you Thanks, Gary
  14. Well, I'm trying to make it so that the slide ends on the last page and shows a sign that whoever's reading has reached the end, but I'm not too experient on JavaScript, could you guys help me on that? Here's the code: <html> <title>Terra Formars</title> <link href="https://www.w3schools.com/w3css/4/w3.css" rel="stylesheet"></link> <style> .mySlides {display:none} </style> <body> <div class="w3-container"> <h2> Leitor BETA</h2> <p>Capítulo 202 de Terra Formars.</p> </div> <div class="w3-center"> <div class="w3-section"> <button class="w3-button w3-light-grey" onclick="plusDivs(-1)">❮ Prev</button> <button class="w3-button w3-light-grey" onclick="plusDivs(1)">Next ❯</button> </div> </div> <div class="w3-content"> <img class="mySlides" src="https://i.ibb.co/fqQw2mX/00.png" style="width: 100%;" /> <img class="mySlides" src="https://i.ibb.co/CQ9VjsF/01.jpg" style="width: 100%;" /> <img class="mySlides" src="https://i.ibb.co/FVfsh9c/02.jpg" style="width: 100%;" /> <img class="mySlides" src="https://i.ibb.co/sq7czrk/03.jpg" style="width: 100%;" /> <img class="mySlides" src="https://i.ibb.co/By7k2J4/04.jpg" style="width: 100%;" /> <img class="mySlides" src="https://i.ibb.co/NnYp2xH/05.jpg" style="width: 100%;" /> <img class="mySlides" src="https://i.ibb.co/cXkgpK0/06.jpg" style="width: 100%;" /> <img class="mySlides" src="https://i.ibb.co/CW8fr43/07.jpg" style="width: 100%;" /> <img class="mySlides" src="https://i.ibb.co/LJ25GnH/08.jpg" style="width: 100%;" /> <img class="mySlides" src="https://i.ibb.co/Khbg5h9/09.jpg" style="width: 100%;" /> <img class="mySlides" src="https://i.ibb.co/wRrdp5T/10.jpg" style="width: 100%;" /> <img class="mySlides" src="https://i.ibb.co/TTnfdvv/11.jpg" style="width: 100%;" /> <img class="mySlides" src="https://i.ibb.co/72rLfpX/12.jpg" style="width: 100%;" /> <img class="mySlides" src="https://i.ibb.co/x8zR2yp/13.jpg" style="width: 100%;" /> <img class="mySlides" src="https://i.ibb.co/zXv7HJg/14.jpg" style="width: 100%;" /> <img class="mySlides" src="https://i.ibb.co/4tkwzt8/15.jpg" style="width: 100%;" /> <img class="mySlides" src="https://i.ibb.co/hHW04cS/16.jpg" style="width: 100%;" /> <img class="mySlides" src="https://i.ibb.co/dGx73nH/17.jpg" style="width: 100%;" /> <img class="mySlides" src="https://i.ibb.co/rx8G6Yr/18.jpg" style="width: 100%;" /> <img class="mySlides" src="https://i.ibb.co/4W1v7WS/19.jpg" style="width: 100%;" /> <img class="mySlides" src="https://i.ibb.co/qMYLTJz/20.jpg" style="width: 100%;" /> <img class="mySlides" src="https://i.ibb.co/3yG8h2N/22.jpg" style="width: 100%;" /> </div> <div class="w3-center"> <div class="w3-section"> <button class="w3-button w3-light-grey" onclick="plusDivs(-1)">❮ Prev</button> <button class="w3-button w3-light-grey" onclick="plusDivs(1)">Next ❯</button> </div> </div> <script> var slideIndex = 1; showDivs(slideIndex); function plusDivs(n) { showDivs(slideIndex += n); } function currentDiv(n) { showDivs(slideIndex = n); } function showDivs(n) { var i; var x = document.getElementsByClassName("mySlides"); var dots = document.getElementsByClassName("demo"); if (n > x.length) {slideIndex = 1} if (n < 1) {slideIndex = x.length} 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(" w3-red", ""); } x[slideIndex-1].style.display = "block"; dots[slideIndex-1].className += " w3-"; } </script> </body> </html>
  15. Hello! I am looking for some assistance with my drop down panel. When I try to add "<div id="panel"></div> to the "select to filter by type section", it does not toggle the panel at all. Can you tell me what I am doing incorrectly? http://jsfiddle.net/AlanaVibes/xNj9z/92/#&amp;togetherjs=ROVpoPMv4L <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery UI Checkboxradio - Default functionality</title> <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <link rel="stylesheet" href="/resources/demos/style.css"> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <script> $( function() { $( "input" ).checkboxradio(); } ); </script> </head> <body> <div class="widget"> <h1>Our Manufacturers</h1> <fieldset> <legend>Select a Territory: </legend> <label for="radio-1">All</label> <input type="radio" name="radio-1" id="radio-1"> <label for="radio-2">North Texas</label> <input type="radio" name="radio-1" id="radio-2"> <label for="radio-3">Oklahoma</label> <input type="radio" name="radio-1" id="radio-3"> <label for="radio-4">Arkansas</label> <input type="radio" name="radio-1" id="radio-4"> </fieldset> <script> &(document).ready(function(){ $("#flip").click(function(){ $("#panel").slideToggle("slow"); }); }); </script> <style> #panel, #flip { padding: 5px; text-align: left; background-color: white; border: solid 1px #c3c3c3; } #panel { padding: 50px; display: none; } </style> <div id="flip"> <h2>Type of Material</h2></div> <fieldset> <legend> Select to filter by Type </legend> <label for="checkbox-1">Wire & Cable</label> <input type="checkbox" name="checkbox-1" id="checkbox-1"> <label for="checkbox-2">Wire & Cable Accessories</label> <input type="checkbox" name="checkbox-2" id="checkbox-2"> <label for="checkbox-3">Conduit & Fittings</label> <input type="checkbox" name="checkbox-3" id="checkbox-3"> <label for="checkbox-4">Wiring Devices</label> <input type="checkbox" name="checkbox-4" id="checkbox-4"> <label for="checkbox-5">Enclosures & Wireway</label> <input type="checkbox" name="checkbox-4" id="checkbox-5"> <label for="checkbox-6">Lighting</label> <input type="checkbox" name="checkbox-4" id="checkbox-6"> <label for="checkbox-7">Fuses</label> <input type="checkbox" name="checkbox-4" id="checkbox-7"> <label for="checkbox-8">Tools & Fasteners</label> <input type="checkbox" name="checkbox-4" id="checkbox-8"> <label for="checkbox-9">Motor Control</label> <input type="checkbox" name="checkbox-4" id="checkbox-9"> <label for="checkbox-10">Specialty</label> <input type="checkbox" name="checkbox-4" id="checkbox-10"> </fieldset> </div> </body> </html>
  16. Hello people, Im stuck for a long time, I have an what older login system on my site but it had mysql but now i wanted to upgrade it to mysqli. I've came litlle by litlle bit of searcing this far but it still got error's. I really want it to work again beacause i use it on all my sites. Code: <?php // Een beveiliging om te voorkomen dat men in je header.php probeert te openen. if(basename($_SERVER['PHP_SELF']) == "header.php") { header("Location: index.php"); } // Configuratie laden include_once('config.php'); // We maken eerst een classe aan class login { // Variabelen private $loginsessie = false; public $fouten = ""; private $gebruikers_info = array(); public $database_velden = array(); private $recheck = 0; // Deze functie wordt aangeroepen bij het laden van de classe public function __construct() { // maak verbinding met de database, als het niet lukt breek het af $con = mysqli_connect(mysql_host, mysql_user, mysql_password, mysql_database) or die(mysqli_error($con)); // mysqli_select_db(mysql_database, $verbinding) or die (mysqli_error($con)); // Controlleren op een login sessie $this->check_session(); // De loguit actie koppelen aan de end_session functie if(isset($_GET['actie']) && $_GET['actie'] == 'uitloggen' && $this->loginsessie === true) { $this->end_session(); } } // Init functie public function init() { // Controlleren op een POST request, wanneer er nog geen loginsessie is if($_SERVER['REQUEST_METHOD'] == 'POST') { /* was eerst if($_SERVER['REQUEST_METHOD'] == 'POST' && $this->loginsessie===false) {*/ if(isset($_POST['actie'])) { switch($_POST['actie']) { case 'login': $this->controleer_gegevens(); break; case 'registreer_gebruiker': $this->registreer_gebruiker(); break; } } } } // Functie om het ip adres op te vragen public function get_ip() { if (isSet($_SERVER)) { if (isSet($_SERVER["HTTP_X_FORWARDED_FOR"])) { $realip = $_SERVER["HTTP_X_FORWARDED_FOR"]; } elseif (isSet($_SERVER["HTTP_CLIENT_IP"])) { $realip = $_SERVER["HTTP_CLIENT_IP"]; } else { $realip = $_SERVER["REMOTE_ADDR"]; } } else { if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) { $realip = getenv( 'HTTP_X_FORWARDED_FOR' ); } elseif ( getenv( 'HTTP_CLIENT_IP' ) ) { $realip = getenv( 'HTTP_CLIENT_IP' ); } else { $realip = getenv( 'REMOTE_ADDR' ); } } return $realip; } private function registreer_gebruiker() { if(isset($_POST['actie']) && $_POST['actie'] == 'registreer_gebruiker') { $velden = array(); if(!is_array($this->database_velden) || !count($this->database_velden)) { die("FOUT: Geen velden opgegeven."); } // Alle velden uit de array doorlopen foreach($this->database_velden as $veld) { $veld = split(':', $veld); // Veldnaam $veld_naam = $veld[0]; $velden[$veld_naam] = $_POST[$veld_naam]; // Veld instellingen $veld_instellingen = split('\|', $veld[1]); foreach($veld_instellingen as $instelling) { if($instelling == 'verplicht' && empty($velden[$veld_naam])) { // Controlleer of het veld is ingevuld $this->fouten .= "- Het veld '". $veld_naam ."' is verplicht<br />"; } elseif($instelling == 'md5') { // Codeer naar md5 $velden[$veld_naam] = md5($velden[$veld_naam]); } elseif(substr($instelling, 0, 3) == 'min') { // Controlleer minimum stringlengte if(strlen($velden[$veld_naam]) < (int) substr($instelling, 4)) { $this->fouten .= "- Het veld '". $veld_naam ."' is te kort.<br />"; } } elseif(substr($instelling, 0, 3) == 'max') { // Controleer maximum stringlengte if(strlen($velden[$veld_naam]) > (int) substr($instelling, 4)) { $this->fouten .= "- Het veld '". $veld_naam ."' is te lang.<br />"; } } elseif(substr($instelling, 0, 2) == "==") { if($velden[$veld_naam] != $_POST[substr($instelling, 2)]) { $this->fouten .= '- De velden '. $veld_naam .' en '. substr($instelling, 2) .' komen niet overeen.<br />'; } } elseif($instelling == "avatar") { $velden[$veld_naam] = ('http://habmoon.org/status/habbie?habbie='.$_POST["gebruikersnaam"].'&direction=4&head_direction=3&action=wlk&gesture=sml&size=b'); } elseif($instelling == 'uniek') { $q = mysqli_query($this->con,"SELECT ". $veld_naam ." FROM gebruikers WHERE ". $veld_naam ." = '". mysqli_real_escape_string($this->con, $velden[$veld_naam]) ."' "); if(!$q) { $this->fouten .= '- Er is een MySQL fout opgetreden <br />'; } else { if(mysqli_num_rows($q)) { $this->fouten .= 'De inhoud van veld '. $veld_naam .' bestaat al<br />'; } } } elseif($instelling == 'email') { // Controleer email if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $velden[$veld_naam])) { $this->fouten .= "- Het email is incorrect.<br />"; } } } } if(!$this->fouten) { // SQL genereren $SQL = "INSERT INTO gebruikers "; $SQL_TMP = ""; foreach($velden as $key=>$value) { $SQL_TMP .= ", ". $key ." = '". mysqli_real_escape_string($this->con, $value) ."' "; } // Eerste komma weghalen $SQL .= "SET ".preg_replace("#^,{0,1}#", '', $SQL_TMP); if($SQL_TMP && mysqli_query($this->con,$SQL)) { header("Location: ../index.php"); } else { $this->fouten = "Er is een MySQL fout opgetreden."; /* om te debuggen gebruik: die(mysqli_error($con)); */ } } } } // Functie om gegevens te controleren private function controleer_gegevens() { // Kijken of we het juiste formulier gebruiken if(isset($_POST['actie']) && $_POST['actie'] == 'login') { // Gegevens van formulier opvragen en escapen tegen mysql injectie $gebruiker = mysqli_real_escape_string($this->con, $_POST['gebruikersnaam']); $wachtwoord = mysqli_real_escape_string($this->con, $_POST['wachtwoord']); // Kijken of we MD5 moeten gebruiken (zie configuratie bestand) if(login_password_md5===true) { $wachtwoord = md5($wachtwoord); } // Kijken of de gegevens correct zijn $query = mysqli_query($this->con,"SELECT * FROM gebruikers WHERE gebruikersnaam = '". $gebruiker ."' AND wachtwoord = '". $wachtwoord ."'"); if(mysqli_num_rows($query)) { // Array gebruikersinfo maken $this->gebruikersinfo = array(); $this->gebruikersinfo['info'] = mysqli_fetch_array($query); // Start sessie return $this->start_session(); } else { // Kijken wat er mis ging: if(mysqli_error($this->con)) { $this->fouten = "Er is een mysql fout opgetreden."; } else { $this->fouten = "Gebruiksnaam en/of wachtwoord is incorrect."; } } } } // Functie om de sessie te controlleren private function check_session() { // Controleren op cookie if($this->recheck>=3) { $this->fouten = "Er is een ongeldige cookie sleutel gevonden die niet kon worden verwijderd."; return false; } if(isset($_COOKIE['sid']) && !empty($_COOKIE['sid'])) { // Er is een niet-lege cookie $sid = mysqli_real_escape_string($this->con, $_COOKIE['sid']); // Controleren of sleutel en ip aanwezig zijn in database $query = mysqli_query($this->con,"SELECT * FROM logins WHERE sid = '". $sid ."' AND ip = '". $this->get_ip() ."'") or die("Er is een fout opgetreden."); if(mysqli_num_rows($query)) { $f = mysqli_fetch_array($query); // Gegevens uit database ophalen $query = mysqli_query($this->con,"SELECT * FROM gebruikers WHERE id = '". $f['uid'] ."' "); if(mysqli_num_rows($query)) { $this->loginsessie = true; $this->gebruikersinfo = array(); $this->gebruikersinfo['info'] = mysqli_fetch_array($query); } } } else { // Er is een ongeldige sleutel gevonden, laten we die eens verwijderen $secondes = login_session_time * 3600; setcookie("sid", "", time()-$secondes, "/"); $this->recheck = $this->recheck + 1; } } // De functie om de login sessie te starten private function start_session() { // Unieke sleutel maken $this->gebruikersinfo['sleutel'] = md5(rand(0,99999999999).date("dmyhis")); // Informatie invoegen in database $info = $this->gebruikersinfo['info']; $SQL = "INSERT INTO logins "; $SQL .= "SET uid = '". mysqli_real_escape_string($this->con, $info['id']) ."' "; $SQL .= ", sid = '". mysqli_real_escape_string($this->con, $this->gebruikersinfo['sleutel']) ."' "; $SQL .= ", ip = '". mysqli_real_escape_string($this->con, $this->get_ip()) ."' "; $SQL .= ", datum = NOW() "; mysqli_query($this->con,$SQL) or die("Error: kon niet inloggen."); // Secondes maken van uren, zie configuratie bestand $secondes = login_session_time * 3600; setcookie("sid", $this->gebruikersinfo['sleutel'], time()+$secondes, "/"); // Verversing header("Location: ".$_SERVER['REQUEST_URI']); } private function end_session() { // index.php?actie=uitloggen // Verwijder sessie mysqli_query($this->con,"DELETE FROM logins WHERE sid = '". $_COOKIE['sid'] ."' AND ip = '". $this->get_ip() ."'") or die("Er is een fout opgetreden."); // verwijder cookie $secondes = login_session_time * 3600; setcookie("sid", "", time()-$secondes, "/"); // Redirect $url = str_replace("actie=uitloggen", "", $_SERVER['REQUEST_URI']); // haal de actie weg header("Location: ".$url); } // Functie om gegevens op te vragen public function get_login_info($wat=false) { // Is er iets aanwezig? if(!$this->loginsessie || !count($this->gebruikersinfo)) { return false; } else { if($wat==='alles') { return $this->gebruikersinfo['info']; } elseif(isset($this->gebruikersinfo['info'][$wat])) { return $this->gebruikersinfo['info'][$wat]; } else { return true; } } } } // Class starten $login = new login(); $login->database_velden = array( /* Velden waarvan de value in de database komt. Plaats die in de database en formulier. Syntax: veldnaam:instellingen Instellingen scheiden met '|'. Instellingen: 'verplicht': [string] Verplicht veld. 'min=int': [int] Minimum aantal karakters dat is vereist. 'max=int': [int] Maximum aantal karakters dat is vereist. '==veldnaam': [string] waarde van dit veld moet overeenkomen met 'veldnaam'. 'md5': [string] Codeer met md5. MOET als laatste. */ 'gebruikersnaam:verplicht|uniek|min=3|max=15|', 'rank:max=15|', 'email:max=100|email|', 'avatar:max=100|avatar|', 'wachtwoord:verplicht|min=3|max=16|==wachtwoord2|md5|' /* was eerst 'wachtwoord:verplicht|min=3|max=16|==wachtwoord2'*/ ); $login->init(); ?> Error: Notice: Undefined property: login::$con in C:\xampp\htdocs\Admin\header.php on line 157 Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, null given in C:\xampp\htdocs\Admin\header.php on line 157 Notice: Undefined property: login::$con in C:\xampp\htdocs\Admin\header.php on line 158 Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, null given in C:\xampp\htdocs\Admin\header.php on line 158 Notice: Undefined property: login::$con in C:\xampp\htdocs\Admin\header.php on line 166 Warning: mysqli_query() expects parameter 1 to be mysqli, null given in C:\xampp\htdocs\Admin\header.php on line 166 Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in C:\xampp\htdocs\Admin\header.php on line 167 Notice: Undefined property: login::$con in C:\xampp\htdocs\Admin\header.php on line 176 Warning: mysqli_error() expects parameter 1 to be mysqli, null given in C:\xampp\htdocs\Admin\header.php on line 176
  17. Hay can someone offer some input(it's definitely not mobile friendly what I wrote) in regards to JavaScript and the html form document, I can't recalls the relationship while testing the JavaScript logic, any inputs welcome. Definitely recommend looking at it via desktop mode if on tablet or phone. 🤗 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> </head> <body> <!--FORM_REGISTER--> <div class="one"> <form action=" " method="post" onsubmit = "return register_details();" /> <!--C--> Country<br><input type="text"id="country"/></br> <!--A--> Age<br><input type="age"id="DOB"/></br> <!--S--> Status<br><input type="text"id="status"/></br> </form> </div> <div class="two"> <form action="submission.html" method="register_details(id)" onsubmit = "return register_details();" /> <!--U-->UserName<br><input type="text" value="" id="UsernName"/></br> <!--P-->Password<br><input type="password"value="" id="Password"/></br> <!--E--> Email<br><input type="Email" value="" id="Email"/></br> Male<br><input type="radio" value="" id="male" /></br> Female<br><input type="radio" value="female" id="female" /></br> Submit<br><input type="submit" value="register" id ="submit "/></br> </form> </div> <style type="text/css"> .one { background-color:#444444; color:white; margin:350px; padding:12px; text-align:left; position:fixed; } .two { background-color:#444444; color:white; margin:350px; padding:12px; text-align:center; position:fixed; left:10px; top:240px; width:1157px; height:1000px; background:#444444; } //body { overflow:hidden; } </style> <!-----------------------------------------------> <script type="text/javascript"> function register_details(id) { // bool checked = false; var username = document.getElementById (id,value,"username").value; var password = document.getElementById (id,"password").value; var email = document.getElementById (id,"email").value; var male = document.getElementById (id,"male").value; var female = document.getElementById (id,"female").value; <!------------------------------------------------------> var submit = document.getElementById (id,"register").value; if ((value === "") || (password === "") || (email === "")) { alert("please correct information"); }if ((male[0].checked === false ) && ( female[1].checked === false )){ console.log("please fix gender"); } else if (ErrorText= "") { alert("please correct information"); }else{ submit(register_details(id)) } } </script> <!------------------------------------------------> </body> </body> </html>
  18. Hi everyone. Before I want to say, Im trying to make a project Raspberry PI 3 and Nodered. I'm logging my data from device to Litesql everything is ok. I just want to take this data from db and make a chart for a specific time, like today, yesterday, last week, last mont, last year. I found a code, and need to change this code for my project in javascript. Can some one help me. My db name is Test and column name is Value This code is working code, which is I take in internet , and I changed just db name and source. // This will handle any device and any attribute as long as it is in the DB var p_30d = 1000*60*60*24*30 ; //30 Days var p_7d = 1000*60*60*24*7 ; //7 Days var p_1d = 1000*60*60*24 ; // 1 Day var d = new Date(); var current = d.getTime(); var today0h = d.setHours(0,0,0,0); var day = d.getDay(); var monday0h = today0h - (day + (day === 0 ? -6:1)) * p_1d; var fromdate = 0; var enddate = 0; var sql = []; var sourcelist = []; var aggrlist = []; var title = ""; // Get the period and the list of data sources // also set some default values if one or the other does not exist yet sourcelist = context.get("sourcelist"); if (sourcelist===undefined) { // if running for the first time sourcelist = []; } aggrlist = context.get("aggrlist"); if (aggrlist===undefined) { // if running for the first time aggrlist = []; } fromdate = context.get("fromdate"); if (fromdate===undefined) { // set the period to a default if it is not selected yet fromdate = current-p_1d; } enddate = context.get("enddate"); if (enddate===undefined) { // set the period to a default if it is not selected yet enddate = current; } switch(msg.topic) { case "period": switch(msg.payload) { case "today": fromdate = today0h; enddate = today0h+p_1d; break; case "yesterday": fromdate = today0h-p_1d; enddate = today0h; break; case "thisweek": fromdate = monday0h; enddate = monday0h+p_7d; break; case "lastweek": fromdate = monday0h-p_7d; enddate = monday0h; break; case "last24h": fromdate = current-p_1d; enddate = current; break; case "last7d": fromdate = current-p_7d; enddate = current; break; case "last30d": fromdate = current-p_30d; enddate = current; break; } context.set("fromdate",fromdate); context.set("enddate",enddate); break; case "datasource": if (msg.payload==="delete") { // remove all previous data sources sourcelist = []; } else { sourcelist = context.get("sourcelist"); if (sourcelist===undefined) { // if running for the first time sourcelist = []; } sourcelist.push(msg.payload); } context.set("sourcelist",sourcelist); break; case "aggrsource": if (msg.payload==="delete") { // remove all previous data sources aggrlist = []; } else { aggrlist = context.get("aggrlist"); if (aggrlist===undefined) { // if running for the first time aggrlist = []; } aggrlist.push(msg.payload); } context.set("aggrlist",aggrlist); break; case "minus1w": fromdate = fromdate-p_7d; enddate = enddate-p_7d; context.set("fromdate",fromdate); context.set("enddate",enddate); break; case "plus1w": fromdate = fromdate+p_7d; enddate = enddate+p_7d; context.set("fromdate",fromdate); context.set("enddate",enddate); break; case "minus1d": fromdate = fromdate-p_1d; enddate = enddate-p_1d; context.set("fromdate",fromdate); context.set("enddate",enddate); break; case "plus1d": fromdate = fromdate+p_1d; enddate = enddate+p_1d; context.set("fromdate",fromdate); context.set("enddate",enddate); break; } // Regenerate the SQL statements // Run through the data source list an generate the SQL statements sql = []; if (sourcelist.length>0) { for (var i = 0; i < sourcelist.length; i++) { var parts = sourcelist[i].split("/"); sql.push({ topic: "SELECT * FROM sensor_data WHERE device='"+parts[0]+"' AND sensor='"+parts[1]+"' AND epoch >= " + fromdate + " AND epoch <= " + enddate }); } } if (aggrlist.length>0) { for (var i = 0; i < aggrlist.length; i++) { var parts = aggrlist[i].split("/"); sql.push({ topic: "SELECT * FROM sensor_aggr WHERE device='"+parts[0]+"' AND sensor='"+parts[1]+"' AND epoch >= " + fromdate + " AND epoch <= " + enddate }); } } if (sql.length===0) { // Dummy select that returns nothing to clear the chart sql.push({ topic: "SELECT * FROM sensor_data WHERE device='xxxx'" }); } // set the completed flag for the join node later sql[sql.length-1].complete=true; // pass along the email flag to redirect the flow later if (msg.topic==="email") { sql[sql.length-1].email=true; } // Generate report title if (sourcelist.length===0 && aggrlist.length===0) { title = "No data source"; } else { if (sourcelist.length!==0) { title = title + sourcelist.toString()+ ", "; } if (aggrlist.length!==0) { title = title + aggrlist.toString()+ ", "; } title = title.substring(0,title.length-2); title = title + " | "; var d = new Date(); d.setTime(fromdate); var yyyy = d.getFullYear(); var mm = d.getMonth() < 9 ? "0" + (d.getMonth() + 1) : (d.getMonth() + 1); // getMonth() is zero-based var dd = d.getDate() < 10 ? "0" + d.getDate() : d.getDate(); var hh = d.getHours() < 10 ? "0" + d.getHours() : d.getHours(); var mmm = d.getMinutes() < 10 ? "0" + d.getMinutes() : d.getMinutes(); var ss = d.getSeconds() < 10 ? "0" + d.getSeconds() : d.getSeconds(); title = title + dd + "." + mm + "." + yyyy; d.setTime(enddate); yyyy = d.getFullYear(); mm = d.getMonth() < 9 ? "0" + (d.getMonth() + 1) : (d.getMonth() + 1); // getMonth() is zero-based dd = d.getDate() < 10 ? "0" + d.getDate() : d.getDate(); hh = d.getHours() < 10 ? "0" + d.getHours() : d.getHours(); mmm = d.getMinutes() < 10 ? "0" + d.getMinutes() : d.getMinutes(); ss = d.getSeconds() < 10 ? "0" + d.getSeconds() : d.getSeconds(); title = title + " - " + dd + "." + mm + "." + yyyy; } sql[sql.length-1].title=title; return [ sql ]; This is I changed code but not working. // This will handle any device and any attribute as long as it is in the DB var p_30d = 1000*60*60*24*30 ; //30 Days var p_7d = 1000*60*60*24*7 ; //7 Days var p_1d = 1000*60*60*24 ; // 1 Day var d = new Date(); var current = d.getTime(); var today0h = d.setHours(0,0,0,0); var day = d.getDay(); var monday0h = today0h - (day + (day === 0 ? -6:1)) * p_1d; var fromdate = 0; var enddate = 0; var sql = []; //var sourcelist = []; var aggrlist = []; var title = ""; // Get the period and the list of data sources // also set some default values if one or the other does not exist yet sourcelist = context.get("sourcelist"); if (sourcelist===undefined) { // if running for the first time sourcelist = []; } aggrlist = context.get("aggrlist"); if (aggrlist===undefined) { // if running for the first time aggrlist = []; } fromdate = context.get("fromdate"); if (fromdate===undefined) { // set the period to a default if it is not selected yet fromdate = current-p_1d; } enddate = context.get("enddate"); if (enddate===undefined) { // set the period to a default if it is not selected yet enddate = current; } switch(msg.topic) { case "period": switch(msg.payload) { case "today": fromdate = today0h; enddate = today0h+p_1d; break; case "yesterday": fromdate = today0h-p_1d; enddate = today0h; break; case "thisweek": fromdate = monday0h; enddate = monday0h+p_7d; break; case "lastweek": fromdate = monday0h-p_7d; enddate = monday0h; break; case "last24h": fromdate = current-p_1d; enddate = current; break; case "last7d": fromdate = current-p_7d; enddate = current; break; case "last30d": fromdate = current-p_30d; enddate = current; break; } context.set("fromdate",fromdate); context.set("enddate",enddate); break; case "datasource": if (msg.payload==="delete") { // remove all previous data sources sourcelist = []; } else { sourcelist = context.get("sourcelist"); if (sourcelist===undefined) { // if running for the first time sourcelist = []; } sourcelist.push(msg.payload); } context.set("sourcelist",sourcelist); break; case "aggrsource": if (msg.payload==="delete") { // remove all previous data sources aggrlist = []; } else { aggrlist = context.get("aggrlist"); if (aggrlist===undefined) { // if running for the first time aggrlist = []; } aggrlist.push(msg.payload); } context.set("aggrlist",aggrlist); break; } // Regenerate the SQL statements // Run through the data source list an generate the SQL statements sql = []; if (sourcelist.length>0) { for (var i = 0; i < sourcelist.length; i++) { var parts = sourcelist[i].split("/"); sql.push({ topic: "SELECT Value FROM Test" +value[0]+""+value[1]+ fromdate + " " + enddate }); } } //if (aggrlist.length>0) { // for (var i = 0; i < aggrlist.length; i++) { // var parts = aggrlist[i].split("/"); // sql.push({ topic: "SELECT Value FROM Test" +value[0]+""+value[1] + fromdate + " " + enddate }); // } //} if (sql.length===0) { // Dummy select that returns nothing to clear the chart sql.push({ topic: "SELECT Value FROM Test" }); } // set the completed flag for the join node later sql[sql.length-1].complete=true; // pass along the email flag to redirect the flow later if (msg.topic==="email") { sql[sql.length-1].email=true; } // Generate report title if (sourcelist.length===0 && aggrlist.length===0) { title = "No data source"; } else { if (sourcelist.length!==0) { title = title + sourcelist.toString()+ ", "; } if (aggrlist.length!==0) { title = title + aggrlist.toString()+ ", "; } title = title.substring(0,title.length-2); title = title + " | "; var d = new Date(); d.setTime(fromdate); var yyyy = d.getFullYear(); var mm = d.getMonth() < 9 ? "0" + (d.getMonth() + 1) : (d.getMonth() + 1); // getMonth() is zero-based var dd = d.getDate() < 10 ? "0" + d.getDate() : d.getDate(); var hh = d.getHours() < 10 ? "0" + d.getHours() : d.getHours(); var mmm = d.getMinutes() < 10 ? "0" + d.getMinutes() : d.getMinutes(); var ss = d.getSeconds() < 10 ? "0" + d.getSeconds() : d.getSeconds(); title = title + dd + "." + mm + "." + yyyy; d.setTime(enddate); yyyy = d.getFullYear(); mm = d.getMonth() < 9 ? "0" + (d.getMonth() + 1) : (d.getMonth() + 1); // getMonth() is zero-based dd = d.getDate() < 10 ? "0" + d.getDate() : d.getDate(); hh = d.getHours() < 10 ? "0" + d.getHours() : d.getHours(); mmm = d.getMinutes() < 10 ? "0" + d.getMinutes() : d.getMinutes(); ss = d.getSeconds() < 10 ? "0" + d.getSeconds() : d.getSeconds(); title = title + " - " + dd + "." + mm + "." + yyyy; } sql[sql.length-1].title=title; return [ sql ];
  19. Hi everyone, I'm trying to create the look like "paginate data page", but it is not. I set up the file to insert in website by iframe, but I need to find a way to make clicked data like click the checkbox, then click on next, go to next file in iframe, then come back, stay checked in checkbox. Do you understand what I mean? I'm not fluent in English, my prime is American Sign Language.
  20. Hello potential helpers, im currently having issues with firing an ajax request inside of another ajax request. Heres my code: Im not getting "alert(content)" Condition if(shop[1] == "gserver") and if(name.includes(shopname) == true) are definetly true. The function is correctly called as well. No Im not using jquery for reasons. Anyone has an idea why the 2nd requests isnt fired? Is it not waiting for the first one to finish? function initiate_shop_game(shopname) { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if(this.readyState == 4 && this.status == 200) { var obj = this.responseText; var array = eval("[" + obj + "]"); var r = 1; for(var i = 0; i < array.length; i++) { for(var x = 0; x < array[i].length; x++) { var shop = array[i][x] + ''; shop = shop.split(","); if(shop[1] == "gserver") { var name = shop[2]; var imgname = shop[7] var shopvalues = shop[3].split("{%TEND%}"); var minslots = parseInt(shopvalues[1]); var maxslots = parseInt(shopvalues[2]); var minram= parseInt(shopvalues[3]); var maxram = parseInt(shopvalues[4]); var pricea = (parseFloat(shop[5]) / 30); var priceb = (parseFloat(shop[6] / 30)); var content = [name,imgname,minslots,maxslots,minram,maxram,pricea,priceb]; if(name.includes(shopname) == true) { var div = document.createElement('div'); div.id = name; var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { alert(content); }; xmlhttp.open('POST',"/template_shop.php", true); xmlhttp.send(); } } } } } } }; xmlhttp.open('POST',"/get_shop_data.php", true); xmlhttp.send(); }
  21. CONCERN: The following function does what it is suppose to do -- namely, select at random and without duplication a given number of elements from an array of elements. However, I fear that it is hopelessly awkward and would like your professional assessment of its construction. You will likely not find another like it on the internet, but parts of it were obtained therefrom. function selectCubes(gates) { function onlyUnique(value, index, self) { return self.indexOf(value) === index; } var cubes = ['cube_one', 'cube_two', 'cube_three', 'cube_four', 'cube_five', 'cube_six', 'cube_seven']; var selectedCubes = []; var filteredCubes = []; var n = 0; while (n < gates) { selectedCube = cubes[Math.floor(Math.random()*cubes.length)]; selectedCubes.push(selectedCube); if (filteredCubes.length < gates) { var filteredCubes = selectedCubes.filter(onlyUnique); n++; } } return filteredCubes; } console.log('selectCubes(3):' + selectCubes(3)); Please comment and have a great weekend! Roddy
  22. Hi, i make one but it will be many line same, like this with 20. document.getElementById("Test1").value = Dotoff; document.getElementById("Test2").value = Dotoff; document.getElementById("Test3").value = Dotoff; i wonder can it make all id in one? i tried it: document.getElementById("Test1","Test2","Test3").value = Dotoff; but it didn't work well, only Test1 change. some know how make all 20 in one? it can save me lots space/line ;)
  23. I'm trying to create a script that contains an if/else statement that uses an outside input to change the color of a box in the html file. Currently I am not seeing any changes, so right now I'm checking if the script is even being noticed and ran. I'll admit that I'm not very good at this, so I apologize if these are really simple problems to fix or that they've been fixed before and I missed it when searching for other posts. If it's the latter, could you send me a link. Placement: Currently the script is inside the a style tag, and both are outside the body. Should I not have it in the style tag? Should I keep it outside of the body? If the issue is placement, where should I place it. Currently the if/else statement is not in a function. Does it need to be in a function? If so, how should I set it up so the function gets called every time, but does nothing until the if condition is met? if I don't need it to be a function to run this, how else can I set it up so it will run? Here's the part of the code that I'm working on, Ignore the contents as all I'm looking for is how to get the script to be noticed and ran. <script= text/javascript> var StopTimePivatic = [[175]]; if (StopTimePivatic != 0){ #b[[141]]{ style.background-color= silver; } } else{ #b80, #b81, #b82, #b83, #b84, #b85, #b86, #b87, #b88, #b89, #b90 { style.background-color = Yellow; style.color = black; } #b0, #b1, #b2, #b3, #b4, #b5, #b6, #b7, #b8, #b9, #b10, #b11, #b12, #b13, #b14, #b15, #b16, #b17, #b18, #b19, #b20, #b21, #b22, #b23, #b24, #b25, #b26, #b27, #b28, #b29, #b30, #b31, #b32, #b33, #b34, #b35, #b36, #b37, #b38, #b39, #b40, #b41, #b42, #b43, #b44, #b45, #b46, #b47, #b48, #b49, #b50, #b51, #b52, #b53, #b54, #b55, #b56, #b57, #b58, #b59, #b60, #b61, #b62, #b63, #b64, #b65, #b66, #b67, #b68, #b69, #b70, #b71, #b72, #b73, #b74, #b75, #b76, #b77, #b78, #b79 { style.background-color = red; } } </script> </style> <body onload="bundle()"> As I said previously, If as similar problem to this has been solved, please let me know where i can find it.
  24. BACKGROUND: Recently I had occasion to make a search on my own website using the Newsletter search engine. What I discovered was the most bizarre of behaviors. I could perform one search in Japanese and then no more. In other languages such as French, German, and English I could perform as many searches as I liked -- even repeating the same words more than once -- and I always I was able to produce the expected result. Mind you, this bizarre one-find-stop--all-further-finds behavior in the Japanese language was not the case when I first installed my search engines. Now, I have checked my PHP error.log file and found nothing related to this problem. I have also checked that the parameter value of the AJAX call is being properly passed; here too there is no unusual behavior. This bizarre behavior was not always the case. It appears to have begun taking place all of its own. Any ideas? Roddy
  25. BACKGROUND: I am baffled by the failure of this code to display "Return User" when the browser page is refreshed or the browser page is closed and then reopened. The vslue of the console.log(localStorage) displays: Storage { return_user: "true", length: 1 } CODE: const output = document.querySelector('.output'); if (typeof localStorage !== "undefined") { var localStorage = window.localStorage; if(localStorage.getItem("return_user")) { output.innerHTML = "Return User"; } else { output.innerHTML = "New User"; localStorage.setItem("return_user", true); console.log(localStorage); } } else { output.innerHTML = "Sorry, local storage is not supported."; } QUESTION: Any ideas? Roddy
×
×
  • Create New...