I can't figure out my JavaScript function is not working - javascript
I have to create a game where the user has to guess a number, for that I call a JavaScript function on an external file which is activated when the button is clicked.
My HTML:
`
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Devoir JavaScript</title>
</head>
<body>
<p>Vous devez trouver un nombre compris entre 1 et 100 !</p>
<form name="myForm" method="POST"></form>
Nombre : <input type="text" name="nombre" value="" />
<input type="button" onclick="return verif()" value="Jouer" />
</form>
<script type="text/javascript" src="script.js"></script>
</body>
</html>
`
My JavaScript:
var numero = Math.floor(Math.random() * 100) + 1;
var essai = 0;
function verif() {
essai++;
var choix = document.forms["myForm"]["choix"].value;
if (choix == null || choix == "") {
alert("Indiquer un nombre !");
return false;
}
if (choix < numero) {
alert = "Le nombre indiquer est trop petit !";
return false;
}
if (choix > numero) {
alert = "Le nombre indiquer est trop grand !";
return false;
}
if (choix == numero) {
alert = "Bravo vous avez trouver en " + essai + "essais !";
return true;
}
}
I have checked the name of my files and their extentions so as not to make a mistake.
I don't understand or I made a mistake.
PS: I am new to JavaScript.
I have been looking since yesterday so thank you for your help.
I tried running your code and inside Console it says the value could not be read. I slightly changed your Javascript code and it worked.
//var choix = document.forms["myForm"]["choix"].value; code before
var choix = document.getElementsByName("nombre").value; //after changed
When using Javascript if your code is not running, you should press F12 and look at the Console to see what your code is failing.
This is the full code that I changed:
var numero = Math.floor(Math.random() * 100) + 1;
var essai = 0;
function verif() {
essai++;
var choix = document.getElementsByName("choix").value;
document.write(choix);
if (choix == null || choix == "") {
alert("Indiquer un nombre !");
return false;
}
if (choix < numero) {
alert = "Le nombre indiquer est trop petit !";
return false;
}
if (choix > numero) {
alert = "Le nombre indiquer est trop grand !";
return false;
}
if (choix == numero) {
alert = "Bravo vous avez trouver en " + essai + "essais !";
return true;
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Devoir JavaScript</title>
</head>
<body>
<p>Vous devez trouver un nombre compris entre 1 et 100 !</p>
<form name="myForm" method="POST"></form>
Nombre : <input type="number" name="choix" value=""/>
<input type="button" onclick="return verif()" value="Jouer" />
</form>
</body>
</html>
Your error says that you are accessing the property value from undefined.
There is no "choix" in your HTML.
You can use indices to get your particular element value:
var choix = document.forms[0].elements[0].value;
Or keeping the same approach as yours, I can use the correct field "nombre" :
var choix = document.forms["myForm"]["nombre"].value;
Related
Problem with Javascript about taken or available username
I have a problem, I did a taken/available username status that work correctly, but when I want to disable my submit button, this isn't working, I don't know why, please help me. HTML input : <input onkeyup="checkUsername()" id="username" name="username" type="text" class="form-control" value="<?php echo $row['username'] ?>" placeholder="Nom d'utilisateur" required autocomplete="off"> Javascript : <script> function checkUsername() { const username = document.getElementById("username").value; const xhr = new XMLHttpRequest(); xhr.open("POST", "check_username.php", true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function () { if (xhr.readyState === 4 && xhr.status === 200) { const response = xhr.responseText; const usernameMessage = document.getElementById("usernameMessage"); if (response === "Nom d'utilisateur disponible.") { usernameMessage.innerHTML = "<span style='color:green;'>Nom d'utilisateur disponible.</span>"; usernameMessage.style.display = "flex"; document.getElementById('submit-button').disabled = false; } else if (response === "Ce nom d'utilisateur est déjà pris.") { usernameMessage.innerHTML = "<span style='color:red;'>Ce nom d'utilisateur est déjà pris.</span>"; usernameMessage.style.display = "flex"; document.getElementById('submit-button').disabled = true; } else { // gérer d'autres réponses ici } } }; xhr.send("username=" + username); } </script> PHP and MySQL : <?php session_start(); // Connexion à la base de données include "./config.php"; // Vérification de la connexion if ($mysqli->connect_errno) { echo "Erreur de connexion à la base de données: " . $mysqli->connect_error; exit(); } // Récupération du nom d'utilisateur envoyé en POST $username = $_GET['username']; // Requête SQL pour vérifier si le nom d'utilisateur est déjà pris $query = "SELECT COUNT(*) as count FROM users WHERE username = ?"; $stmt = $mysqli->prepare($query); $stmt->bind_param("s", $username); $stmt->execute(); $stmt->bind_result($count); $stmt->fetch(); $stmt->close(); // Vérification du résultat header('Content-Type: application/json'); if ($count > 0) { echo "<div class='usernameMessage no'>Ce nom d'utilisateur est déjà pris.</div>"; echo "<script> document.getElementById('submit-button').disabled = true; </script>"; } else { echo "<div class='usernameMessage yes'>Ce nom d'utilisateur est disponible.</div>"; echo "<script> document.getElementById('submit-button').disabled = false; </script>"; } // Fermeture de la connexion à la base de données $mysqli->close(); ?> <style> .usernameMessage { } .yes{ color: green; } .no { color: red; } </style> I tried to put document.getElementById('submit-button').disabled = false; but it doesn't work, maybe because something is enabling my button ...
There are many flaws in your code. You are using $_GET method in PHP code but $_POST method in Javascript code. PHP code response does not seem to adapt to Javascript code Here is the corrected code HTML <input onkeyup="checkUsername()" id="username" name="username" type="text" class="form-control" value="<?php echo $row['username'] ?>" placeholder="Nom d'utilisateur" required autocomplete="off"> <div id="usernameMessage"></div> <button type="submit" id="submit-button" disabled>Submit</button> JavaScript: function checkUsername() { const username = document.getElementById("username").value; const xhr = new XMLHttpRequest(); xhr.open("POST", "check_username.php", true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function () { if (xhr.readyState === 4 && xhr.status === 200) { const response = JSON.parse(xhr.responseText); const usernameMessage = document.getElementById("usernameMessage"); if (response.available) { usernameMessage.innerHTML = "<span style='color:green;'>Nom d'utilisateur disponible.</span>"; usernameMessage.style.display = "flex"; document.getElementById('submit-button').disabled = false; } else { usernameMessage.innerHTML = "<span style='color:red;'>Ce nom d'utilisateur est déjà pris.</span>"; usernameMessage.style.display = "flex"; document.getElementById('submit-button').disabled = true; } } }; if (username.trim() !== '') { xhr.send("username=" + username); } } PHP: session_start(); // Connexion à la base de données include "./config.php"; // Vérification de la connexion if ($mysqli->connect_errno) { echo json_encode(['error' => "Erreur de connexion à la base de données: " . $mysqli->connect_error]); exit(); } // Récupération du nom d'utilisateur envoyé en POST if (isset($_POST['username'])) { $username = $_POST['username']; // Requête SQL pour vérifier si le nom d'utilisateur est déjà pris $query = "SELECT COUNT(*) as count FROM users WHERE username = ?"; $stmt = $mysqli->prepare($query); $stmt->bind_param("s", $username); if ($stmt->execute()) { $stmt->bind_result($count); $stmt->fetch(); $stmt->close(); // Vérification du résultat if ($count > 0) { echo json_encode(['available' => false]); } else { echo json_encode(['available' => true]); } } else { echo json_encode(['error' => "Erreur lors de l'exécution de la requête SQL."]); } } else { echo json_encode(['error' => "Le paramètre 'username' n'a pas été fourni."]); }
calling return from a function to use in a variable in another function? javascript
Im doing a shopping simulator using loops and functions. When the user sets a quantity thru promt this get verify with a function and gives me an number. I want to use that return to calculate the instalation fee related to the amount of product buyed but cant get the fuction to work. It takes the value as 0 or stop working. Any idea? This is the shopping function const comprarEquipos = () => { // Flujo principal let equipo = ''; let cantidad = 0; let precio = 0; let totalPedido = 0; let seguirComprando = false; do { equipo = prompt("¿Que minisplit buscas:? inverter, convencional o alta eficiencia","Ej. convencional").toLowerCase(); cantidad = parseInt(prompt ("¿Cuantos equipos necesitas?", "Ej. 2")); const cantidadComprobada = comprobarCantidad(cantidad) switch (equipo) { case "convencional": precio = 4900; break; case "inverter": precio = 7500; break; case "alta Eficiencia": precio = 12000; break; default: alert("Ingresa una opcion de producto valida"); precio = 0; cantidad = 0; } totalPedido += precio*cantidadComprobada; seguirComprando = confirm("¿Deseas seguir comprando?"); } while (seguirComprando) const totalConInstalacion = calcularInstalacion(totalPedido); return totalConInstalacion; }; and this is the function i used to verify the quantity const comprobarCantidad = (cantidad) => { while (Number.isNaN(cantidad) || cantidad === 0) { if (cantidad !== 0) { alert("Debes especificar una cantidad.") } else { alert("Debes pedir una cantidad superior a 0.") } cantidad = parseInt(prompt("¿Cuantos equipos necesitas?", "Ej. 2")); } return cantidad; } this is the function to calcutate the instalation fee but doesnt seem to get the quantity right const calcularInstalacion = (totalPedido) => { let cantidadMinisplits = comprobarCantidad(cantidad); let solicitaEnvio = confirm("¿Necesitas instalacion"); // 2.1 Aqui le preguntaremos al usuario si quiere envio y ese valor se aloja en la variante solicitaEnvio como true si da OK if (solicitaEnvio && cantidadMinisplits >= 7) { totalPedido = cantidadMinisplits*600; alert("Por "+cantidadMinisplits+" equipos el costo de instalación es $"+totalPedido); } else if (solicitaEnvio && cantidadMinisplits <= 6 && cantidadMinisplits !== 0) { totalPedido = cantidad*1100; alert("Por "+cantidadMinisplits+" equipos el costo de instalación es $"); } else { alert("No se cobrara servicio de instalación") } return totalPedido; } But the promt asking for confirmation on installtion doesnt show up at all. What am I doing wrong? How cant I get it to work? I i change the value from cantidadMinisplit to a number, the function works correctly const calcularInstalacion = (totalPedido) => { let cantidadMinisplits = comprobarCantidad(cantidad); let solicitaEnvio = confirm("¿Necesitas instalacion"); // 2.1 Aqui le preguntaremos al usuario si quiere envio y ese valor se aloja en la variante solicitaEnvio como true si da OK if (solicitaEnvio && cantidadMinisplits >= 7) { totalPedido = cantidadMinisplits*600; alert("Por "+cantidadMinisplits+" equipos el costo de instalación es $"+totalPedido); } else if (solicitaEnvio && cantidadMinisplits <= 6 && cantidadMinisplits !== 0) { totalPedido = cantidad*1100; alert("Por "+cantidadMinisplits+" equipos el costo de instalación es $"); } else { alert("No se cobrara servicio de instalación") } return totalPedido; } but calling the validation fuction doesnt work
It was a scoping issue as Fiddling Away suggested. I also used that suggestion to improve the simulator. Changing cantidad did solve the issue, thank you and sorry for not translating the variable names, I will do it for future questions.
I tried to make an alternative that tells the user if the number he has chosen is the right one, above it or under it
A number is randomly chosen and I want it to appear in my console.log at line 29, so that the following alternative can work. For the moment, whether I type down a number lower or higher than the ramdom one, the text of the first part of my alternative is the one that applies. Can someone help? window.addEventListener("load", genererNbAleatoire) //Valeurs que vous pouvez utiliser pour les verdicts const min = 0; const max = 100; let nb = min + (max - min + 1) * (Math.random()); //J'ajoute mes écouteurs d'évènement document.getElementById('btnGo').addEventListener("click", verifierNombre); document.getElementById('btnReset').addEventListener("click", reinitialiserJeu); document.getElementById('btnNbEssais').addEventListener("click", connaitreNbEssais); //Je déclare mes variables globales nombreChoisi = document.getElementById('btnGo').innerHTML; champErreur = document.getElementById("error").innerHTML; champInfo = document.getElementById("info").innerHTML; //Fonction qui retourne un nombre aléatoire entre un min et un max function genererNbAleatoire(min, max) { console.log(Math.floor(nb)) return Math.floor(nb); } function verifierNombre() { //console.log('bouton verifierNombre fonctionnel') if (nombreChoisi < nb) { console.log(nombreChoisi) this.champErreur = "Le nombre est trop petit" console.log(this.champErreur) } else { this.champErreur = "Le nombre est trop grand"; } } function reinitialiserJeu() { //console.log('bouton reinitialiserJeu fonctionnel'); } function connaitreNbEssais() { //console.log("bouton connaitreNbEssais fonctionnel"); } <input type="button" id="btnGo" value="Vérifier nombre"> <input type="button" id="btnReset" value="Réinitialiser jeu"> <input type="button" id="btnNbEssais" value="Connaitre nombre d'essais"> <p id="error" class="erreur"></p> <p id="info"></p>
Local storage wont work with <input>
I'm currently trying to make something work for in javascript, as u can see i made a Theater hall with javascript. I made a big table with <input type=checkbox> inside the table data, with generated Id by the loop(which u can see under the if/else in function tekenZaal1(). Now if u press the Load button i want that the checked(pressed) checkboxes will be added to local storage. I've try some but it won't work, it adds only 1 string to to the local storage with key: undefined and value: undefined. i've no idea how to fix this what's wrong with my code? btw: i couldn't get jsfiddle to work with my code idk why but i have a screenshot of my full html and javascript code of the theather hall: http://gyazo.com/a9a3d23ee12e1862e447fab02075446a HTML: <!DOCTYPE html> <html> <head> <title>Reserveringspagina</title> <link type="text/css" rel="stylesheet" href="check.css"> <script type="text/javascript" src="reserveringsjavadeel1.js"></script> </head> <body onload="tekenZaal1()"> <div id="content"> </div> <div id="containergroot"> <div id="content1"></div> <div id="content2"> </div> </div> <button onclick="addStorage()">load</button> </body> </html> javascript: var zaal1 = [ //Array van zaal1// [0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0], [0,0,0,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,0,0,0], [0,0,0,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,0,0,0], [0,0,0,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,0,0,0], [0,0,0,1,1,1,1,2,2,2,2,2,2,3,3,3,3,2,2,2,2,2,2,1,1,1,1,0,0,0], [0,0,1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,3,2,2,2,2,2,1,1,1,1,1,0,0], [0,1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,3,3,3,2,2,2,2,2,1,1,1,1,1,0], [0,1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,3,3,3,2,2,2,2,2,1,1,1,1,1,0], [0,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,3,3,2,2,2,2,2,2,1,1,1,1,0], [0,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,3,3,2,2,2,2,2,2,1,1,1,1,0], [0,1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,3,3,3,2,2,2,2,2,1,1,1,1,1,0], [0,1,1,1,1,1,1,2,2,2,2,3,3,3,3,3,3,3,3,2,2,2,2,1,1,1,1,1,1,0], [0,1,1,1,1,1,1,1,2,2,2,2,2,3,3,3,3,2,2,2,2,2,1,1,1,1,1,1,1,0], [0,0,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,0,0], [0,0,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,0,0], [0,0,0,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,0,0,0], [0,0,0,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,0,0,0], [0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0], [0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0] ]; //Variabelen die worden weergegeven in de <p> die aangemaakt wordt als je op een stoel klikt// //functie die zaal1 tekent// function tekenZaal1() { var zaal = ""; zaal+="<table border='0' id='tabel'>"; for(i = 0; i < zaal1.length; i++){ zaal+='<tr>'; for (j = 0; j < zaal1[i].length; j++){ if (zaal1[i][j] == 1){ zaal+='<td class="prijslaag"><input title="rij'+(i+1)+'stoel'+j+'" type="checkbox" class="stoel1" id="rij'+i+'stoel'+j+'" name="choice" value="7,50" onchange="bereken(1 , checked, Blauw)"></td>'; } else if (zaal1[i][j] == 2){ zaal+='<td class="prijsmiddel"><input title="rij'+(i+1)+'stoel'+j+'" type="checkbox" class="stoel2" id="rij'+i+'stoel'+j+'" name="choice" value="9" onchange="bereken(2, checked, Oranje)"></td>'; } else if (zaal1[i][j] == 3){ zaal+='<td class="prijshoog"><input title="rij'+(i+1)+'stoel'+j+'" type="checkbox" class="stoel3 "id="rij'+i+'stoel'+j+'" name="choice" value="11" onchange="bereken(3 , checked, Rood)"></td>'; } else { zaal+='<td><img src="witlogo.png" width="40" height="40"></td>'; } } zaal+="</tr>"; } zaal+="</table><br>"; document.getElementById("content").innerHTML+= zaal; } function bereken(type, checked, kleur) { if (checked) { if (type == 1) { prijs += 7.50; } else if (type == 2) { prijs += 9; } else if (type == 3) { prijs += 11; } //Maakt een <p> en zet daar de aangeklikte stoel in// var para = document.createElement('p'); para.id = ('stoel'+ type); var node = document.createTextNode(kleur); para.appendChild(node); var element = document.getElementById("content1"); element.appendChild(para); } else { if (type == 1) { prijs -= 7.50; } else if (type == 2) { prijs -= 9; } else if (type == 3) { prijs -= 11; } // Verwijderd de desbetreffende <p>stoel die is aangemaakt// para = document.getElementById('stoel'+type); para.parentElement.removeChild(para); } document.getElementById("content2").innerHTML = "<p id='prijstotaal'>\u20ac"+" "+prijs+"</p>"; } function addStorage() { var stoelen = ['rij'+i+"stoel"+j+""] var zaal = ['zaal1', 'zaal2', 'zaal3'] if ("localStorage" in window) { localStorage.setItem(stoelen.value, zaal.value); alert("localstorage set"); } else { alert("no localStorage in window"); } }
Place an info bubble from right to left when it has no place in the browser window?
someone would have a script idea to place an info bubble from right to left when it has no place in the browser window? thank you for your answers ... My script // Detection du navigateur ns4 = (document.layers)? true:false; ie4 = (document.all)? true:false; // Decallage de l'infobulle par rapport au pointeur en X et en Y (en pixels) decal_x = 10; decal_y = 0; // Creation d'un raccourci pour manipuler le calque var skn = (ns4) ? document.bulle : bulle.style; // Instruction pour Netscape if (ns4) document.captureEvents(Event.MOUSEMOVE); // Interception des mouvements du pointeur // Celui-ci est activé et désactivé par les fonctions // reactiverMouseMove() et desactiverMouseMove() //document.onmousemove = suivre_souris; function popAccueil(nom,adresse,tel,fax,mail) { var contenu; contenu = "<table border='0' cellspacing='0' cellpadding='5' width='200'><tr><td bgcolor='#CCCCFF'>"; contenu += nom + "</td></tr><tr><td bgcolor='#CCCCFF'><u>Adresse</u>: "; contenu += adresse + "</td></tr><tr><td bgcolor='#CCCCFF'><u>Tel</u>: "; contenu += tel + "</td></tr>"; if (fax != null && fax != '') { contenu += "<tr><td bgcolor='#CCCCFF'><u>Fax</u>: " +fax + "</td></tr>"; } if (mail != null && mail != '') { contenu += "<tr><td bgcolor='#CCCCFF'><u>Mail</u>: " + mail + "</td></tr>"; } contenu +="</table>"; if (ns4)// Instructions pour Netscape { skn.document.write(contenu); skn.document.close(); skn.visibility = "visible"; }// Instructions pour Internet Explorer else if (ie4) { document.all("bulle").innerHTML = contenu; skn.visibility = "visible"; } } function popException(exception) { var contenu; //Si exception n'est pas vide on affiche l'info-bulle if(exception!="") { contenu = "<table border='0' cellspacing='0' cellpadding='5' width='200'><tr><td bgcolor='#CCCCFF'>" + exception + "</td></tr></table>"; if (ns4)// Instructions pour Netscape { skn.document.write(contenu); skn.document.close(); skn.visibility = "visible"; }// Instructions pour Internet Explorer else if (ie4) { document.all("bulle").innerHTML = contenu; skn.visibility = "visible"; } } } function pop(message, image) { // Formatage de l'infobulle (ici un tableau bleu) var contenu; if(image == "/stockage/") { contenu = "<table border='0' cellspacing='0' cellpadding='5' width='200'><tr><td bgcolor='#CCCCFF'>" + message + "</td></tr></table>"; } else { contenu = "<table border='0' cellspacing='0' cellpadding='5' width='200'><tr><td bgcolor='#CCCCFF'>" + message + "</td></tr><tr><td><img src="+ image +" border='0'></td></tr></table>"; } // Instructions pour Netscape if (ns4) { skn.document.write(contenu); skn.document.close(); skn.visibility = "visible"; } // Instructions pour Internet Explorer else if (ie4) { document.all("bulle").innerHTML = contenu; skn.visibility = "visible"; } } // Gestion du pointeur function suivre_souris(e) { // Creation des variables de decallage var x = (ns4) ? e.pageX : event.x + document.body.scrollLeft; var y = (ns4) ? e.pageY : event.y + document.body.scrollTop; // Cas particulier pour Internet Explorer sur Mac (les coordonnees de decallages sont modifiees) if ( (navigator.userAgent.indexOf('Mac') != -1) && (navigator.userAgent.indexOf('MSIE') != -1) ) { skn.left = x + decal_x - 135; skn.top = y + decal_y - 155; } // Pour les autres cas, decallage normal du calque par rapport au pointeur else { skn.left = x + decal_x; skn.top = y + decal_y; } } // Fonction pour masquer le calque function disparaitre() { if (ns4) { skn.document.write(''); skn.document.close(); skn.visibility = "hidden"; } else if (ie4) { document.all("bulle").innerHTML = ''; skn.visibility = "hidden"; } } // Désactive la gestion du suivi de souris function desactiverMouseMove(){ document.onmousemove = null; } // Réactive la gestion du suivi de souris function reactiverMouseMove(){ document.onmousemove = suivre_souris; } i want when i have this bubble to place from right to left when it has no place in the browser window,when it is displayed outside window
You can get the window client's width and height and then compare it with your bubble's position. If the bubble's X position added to the bubble's width is bigger than the client's size, the new X position should be equal to the difference between the client's width and the bubble's width. In IE you can get the client's width with document.body.clientWidth and in other browsers you should use window.innerWidth.Here's a simple example: var bx, by; // bx and by stand for the bubble's X and Y position var bw, bh; // bw is the bubble's width and bh is the height // ... some code here ... // ... the bx and by variables get the mouse coordinates ... if (bx+bw>window.innerWidth) bx=window.innerWidth-bw; if (by+bh>window.innerHeight) by=window.innerHeight-bh; I hope I have explained it well. If you didn't understand something, just tell me about it and I'll try to explain it better.