I'm making some tables from MySQL
and was wondering if there was a way to link the tables with foreign keys like in acces
.
If so, what is the way to implement them?
I'm making some tables from MySQL
and was wondering if there was a way to link the tables with foreign keys like in acces
.
If so, what is the way to implement them?
I have a database which I want to import into MySQL, but I have seen that the only method to do this is by converting the Access database into a .sql file, the problem is that I have downloaded programs and have seen tutorials on how to convert it but none have worked for me, if someone knows how to convert an Access database to a file with a .jql extension, could you give me some advice or recommend a program?
This is the only thing I need to finish my project, I need to know how I could remove a phrase that the user enters by keyboard, this through a function activated by a button.
I know that a picture is worth a thousand words, so I'll leave a graphic explanation of what I want to happen.
I advance that I already know that my delete function is wrong, that's why I ask for help.
And of course the code I'm using:
<!DOCTYPE html>
<html>
<head>
<title>Unir con salto de linea</title>
<meta charset="UTF-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<div name="head" class="h">
<table>
<tr>
<form name="prueba" autocomplete="off">
<td><strong>Primera Frase: <input type="text"id="textA" /></td></strong>
<td><strong>Frase final: <input type="text"id="textB" /></td></strong>
<td><select id="sel" required>
<option value="1">Concatenar</option>
<option value="0">Borrar</option>
</select></td>
</table>
</form>
</div>
</tr>
<script>
function unirTexto(){
var c1=document.getElementById('textA').value;
var c2=document.getElementById('textB').value;
var t1=document.getElementById('textC').value;
var rt=document.getElementById('resultado');
var copia= document.getElementById('respuesta');
var p = t1.split(/\n/g);
var resultado = document.getElementById('resultado');
var html = "";
for (var i = 0; i < p.length; i++) {html += c1 +' '+ p[i] +' '+ c2 + "\n"; copia.innerHTML = html; }}
function limpiar() {
document.getElementById('textA').value ="";
document.getElementById('textB').value ="";
document.getElementById('textC').value ="";
document.getElementById('respuesta').innerHTML ="";
}
$(document).ready(function() {
if($(sel).val() == "0") {
$('#borrar').show();
$('#unir').hide();
} else if($(sel).val() == "1") {
$('#borrar').hide();
$('#unir').show();
}
});
$('#sel').on('change', function() {
if($(this).val() == "0") {
$('#borrar').show();
$('#unir').hide();
} else if($(this).val() == "1") {
$('#borrar').hide();
$('#unir').show();
}
});
function borrarTexto(){
var c1=document.getElementById('textA').value;
var c2=document.getElementById('textB').value;
var t1=document.getElementById('textC').value;
var rt=document.getElementById('resultado');
var copia= document.getElementById('respuesta');
var p = t1.split(/\n/g);
var resultado = document.getElementById('resultado');
var html = "";
for (var i = 0; i < p.length; i++) {html += p[i]+ "\n"; copia.innerHTML = html; }}
function cambia(){
document.respuesta.value.split(".").join(",");
}
</script>
<button onclick="unirTexto()" id="unir">Unir</button>
<button onclick="borrarTexto()" id="borrar">Borrar</button>
<button onclick="limpiar()" id="limpiar">Limpiar</button>
<table>
<tr>
<td><strong>Contenido Medio</strong></td>
<td><strong>Resultado</strong></td>
</tr>
<tr>
<td><textarea name="textC" id="textC" cols="91" rows="33"></textarea></td>
<td><textarea id="respuesta" type="text" cols="91" rows="33" placeholder="El resultado se mostrará acá"></textarea></td>
</tr>
</table>
<br>
</body>
</html>
My problem is that I have my JavaScript code to which I want to add Jquery for a dynamic button function, the problem is that I don't know what tags I should use to activate the Jquery.
Basically what I want to do is that when selecting the "concatenate" it shows me the join button and that when selecting "Delete" it shows me the delete button (I have not added this function yet) added to that, that when selecting "concatenate" it hide the delete button and that pressing "Delete" shows me the button to delete.
PS: The clean button is not the same as the delete button. This is my HTML based JavaScript code
<!DOCTYPE html>
<html>
<head>
<title>Unir con salto de linea</title>
<meta charset="UTF-8">
</head>
<body>
<div name="head" class="h">
<table>
<tr>
<form name="prueba" autocomplete="off">
<td><strong>Primera Frase: <input type="text"id="textA" /></td></strong>
<td><strong>Frase final: <input type="text"id="textB" /></td></strong>
<td><select id="sel" required>
<option value="concatenar">Concatenar</option>
<option value="borrar">Borrar</option>
</select></td>
</table>
</form>
</div>
</tr>
<script>
function unirTexto(){
var c1=document.getElementById('textA').value;
var c2=document.getElementById('textB').value;
var t1=document.getElementById('textC').value;
var rt=document.getElementById('resultado');
var copia= document.getElementById('copia');
var p = t1.split(/\n/g);
var resultado = document.getElementById('resultado');
var html = "";
for (var i = 0; i < p.length; i++) {html += c1 +' '+ p[i] +' '+ c2 + "\n"; copia.innerHTML = html; }}
function limpiar() {
document.getElementById('textA').value ="";
document.getElementById('textB').value ="";
document.getElementById('textC').value ="";
document.getElementById('copia').innerHTML ="";
}
</script>
<div name="botons" class="b"><table><tr><td><button onclick="unirTexto()" id="unir">Unir</button>
<button id="borrar">Borrar</button>
<button onclick="limpiar()" id="limpiar">Limpiar</button></td></tr>
</table>
<table>
<tr>
<td><strong>Contenido Medio</strong></td>
<td><strong>Resultado</strong></td>
</tr>
<tr>
<td><textarea name="textC" id="textC" cols="91" rows="33"></textarea></td>
<td><textarea id="copia" type="text" cols="91" rows="33" placeholder="El resultado se mostrará acá"></textarea></td>
</tr>
</table>
</body>
</html>
And this is the code snippet that I don't know where I should put it:
$('#sel').on('change', function() {
$('#' + $(this).val()).prop('disabled', false)
.siblings().prop('disabled', true);
});
$('#sel').on('change', function() {
$('#' + $(this).val()).show()
.siblings().hide();
});
I currently have a situation that really may not be a big deal, but I've tried looking everywhere and haven't really found the answer to my problem.
Well, we all know that the tag <select>
is used to create a list of <option>
, I am working in JavaScript with a code based on HTML, since I am making a page with dynamic elements that do not need to reload the page to fulfill their function, for that reason I do not want put PHP into the code, since PHP needs the page to be reloaded for its functions, the problem is that I have no idea what to do after defining the possible options of the select.
<select id="opcion" required>
<option value="1">boton 1</option>
<option value="2">boton 2</option>
</select>
What I would like to do is that when the first option is selected it shows a button and then if I press the second option, it hides the first button and creates a new one.
The buttons I do know how to configure them, really this question is simple and short, but I can't find anywhere how to apply the conditions of the select, I tried with a IF
, but nothing happened.
First of all, the program works fine, the only problem is with the copy function.
Well, I'll start by giving a brief explanation, I have a code that is used to copy the result of my program, but when it is copied, something like this happens:
Result:
This is the result.
This program is fine.
(Which copies me) This is the result. This program is fine.
My question is how can I make it not copy the "br"? So what I'm trying to achieve is that the output that shows me on the clipboard is the result with the line breaks included but without the br
Wow, I want that:
Line 1 like this
Line 2 like this
Line 3 like this
The line that comes to where the program ends like this
It already shows me that in the result, but when copying it it doesn't happen the same as you can see, the problem is when you press "control + v" to be able to paste the answer, the format is affected and it converts it into a single line
I leave you my code so you can see if it is due to some mistake of mine.
<!DOCTYPE html>
<html>
<head>
<title>Unir con salto de linea</title>
<meta charset="UTF-8">
</head>
<body>
<form name="prueba" autocomplete="off">
Primera Frase: <input type="text"id="textA" />
Frase final: <input type="text"id="textB" />
<br><br>
Contenido Medio
<br>
<textarea name="textC" id="textC" cols="50" rows="10"></textarea>
<br>
</form>
<script>
function unirTexto(){
var c1=document.getElementById('textA').value;
var c2=document.getElementById('textB').value;
var t1=document.getElementById('textC').value;
var rt=document.getElementById('resultado');
var p = t1.split(/\n/g);
var resultado = document.getElementById('resultado');
var html = "";
for (var i = 0; i < p.length; i++) {html += c1 +' '+ p[i] +' '+ c2 + "<br>"; resultado.innerHTML = html;}}
function limpiar() {
document.getElementById('textA').value ="";
document.getElementById('textB').value ="";
document.getElementById('textC').value ="";
resultado.innerHTML = " ";
copia.value= "";
}
function copiarAlPortapapeles(id_elemento) {
var aux = document.createElement("input");
aux.setAttribute("value", document.getElementById(id_elemento).innerHTML);
document.body.appendChild(aux);
aux.select();
document.execCommand("copy");
document.body.removeChild(aux);
}
</script>
<br>
<button onclick="unirTexto()" id="unir">Unir</button>
<button onclick="limpiar()" id="limpiar">Limpiar</button><br>
<p id="resultado"></p>
<br>
<button onclick="copiarAlPortapapeles('resultado')">Copiar resultado</button><br>
<textarea id="copia" type="text" placeholder="Pega aquí para probar"></textarea>
<br>
</form>
</body>
</html>
This really is a simple question, but I would like to know how to create a button, which when clicked shows a textarea, also, I am working with JavaScript, so I wanted to know if it is possible to load the value of a variable directly in the textarea.
In short, I want pressing the "join" button to create a textarea with the full result.
I leave you my code so that you have a clearer idea of what I want to do:
<!DOCTYPE html>
<html>
<head>
<title>Unir con salto de linea</title>
<meta charset="UTF-8">
</head>
<body>
<form name="prueba">
Primera Frase: <input type="text"id="textA" />
Frase final: <input type="text"id="textB" />
<br>
<br>
Contenido Medio
<br>
<textarea name="textC" id="textC" cols="50" rows="10"></textarea>
<br>
</form>
<script>
function unirTexto(){
var c1=document.getElementById('textA').value;
var c2=document.getElementById('textB').value;
var t1=document.getElementById('textC').value;
var p = t1.split(/\n/g);
var resultado = document.getElementById('resultado');
var html = "";
for (var i = 0; i < p.length; i++) {
html += c1 +' '+ p[i] +' '+ c2 + "<br>";
resultado.innerHTML = html;
}}
function limpiar() {
document.getElementById('textA').value =" ";
document.getElementById('textB').value =" ";
document.getElementById('textC').value =" ";
resultado.innerHTML = " ";
}
</script>
<button onclick="unirTexto()" id="unir">Unir</button>
<button onclick="limpiar()" id="limpiar">Limpiar</button><br>
Resultado:<br> <span id="resultado"></span>
<br>
</body>
</html>
Well, the problem that I have been raised is based on the following:
I have three text fields, in the first two I must enter a word or a short phrase and then in the third I must create a paragraph, later with the join button, the three fields must be joined and the data of the first two fields must be appear at the beginning and at the end of each line of the third text, I leave you a graphic example so that my idea is better understood.
Everything that is written in red I did based on paint. (the blue line is imaginary just to mark space)
In addition to the image, I leave this code that is a similar example, but it is not capable of differentiating the line breaks and then adding the first and second data.
<!DOCTYPE html>
<html>
<head>
<title>Ejemplo de JavaScript</title>
<meta charset="UTF-8">
</head>
<body>
<form name="prueba">
Primera Frase: <input type="text"id="textA"; />
Frase final: <input type="text"id="textB"; />
<br><br>
Contenido Medio
<br>
<textarea name="textC" id="textC" cols="50" rows="10">
</textarea>
<br>
</form>
<script>
function unirTexto(){
var c1=document.getElementById('textA').value;
var c2=document.getElementById('textB').value;
var t1=document.getElementById('textC').value;
var resultado= document.getElementById('resultado');
resultado.innerHTML = c1+t1+c2;
}
function limpiar() {
document.getElementById('textA').value = "";
document.getElementById('textB').value = "";
document.getElementById('textC').value = "";
resultado.innerHTML = " ";
}
</script>
<button onclick="unirTexto()" id="Boton">Unir</button>
<button onclick="limpiar()">Limpiar</button> <br>
Resultado: <span id="resultado"></span>
<br>
</body>
</html>
I've been trying to join three different text boxes for a task, but when I want to join the three text boxes into just one, I haven't been able to do it, any ideas...?
<!DOCTYPE html>
<html>
<head>
<title>Ejemplo de JavaScript</title>
<meta charset="UTF-8">
</head>
<body>
<form name="prueba">
Primera Frase: <input type="text"id="textA"; />
Frase final: <input type="text"id="textB"; />
<br>
<br>
Contenido Medio
<br>
<textarea name="textC" id="textC" cols="50" rows="10">
</textarea>
<br>
</form>
<script>
var c1=document.getElementById('textA').textContent;
var c2=document.getElementById('textB').textContent;
var t1=document.getElementById('textC').textContent;
</script>
<form name="resultado">
Resultado:
<br>
<button onclick="document.write(+c1+t1+c2)" id="Boton">Unir</button>
<br>
</form>
</body>
</html>