lundi 31 juillet 2017

Input text multi value

I want to make an website, and to write something in one text input and when a checkbox is checked and the submit button is pressed to write in textarea the checkbox + input text + the same checkbox text, I want to make this with an variable.My script is:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
<script>
    function myPing() {
    var coffee = document.forms[0];
    var txt = "";
    var i;
    for (i = 0; i < coffee.length; i++) {
        if (coffee[i].checked) {
            txt = txt + coffee[i].value + " ";
        }
    }
    var variabilamea123 = document.getElementById("prefix12343242342")
    var theprefix = variabilamea123.value;
    var myvariable12345 = `Hello guys ` + theprefix + ` This was the prefix!`

document.getElementById("order").value = txt + theprefix;
}
</script>
</head>
<div>
<body>
    <center><h1>Discord Easy bot maker</h1></center>
<center>
    <form>
        <h3>Write here your prefix:</h3>
        <input type="text" maxlength="23" name="prefix123" id="prefix12343242342"><br>
        <input type="button" onclick="myPing()" value="Update the prefix"></input>
        <br>
<input type="checkbox" name="coffee" value= myvariable12345>Playing a game<br>
<input type="checkbox" name="coffee" value="                                                                                                                                                                                               client.on('ready', () =>  { 
    client.user.setGame('d!help')
});
});">Playing a game!<br>
<br>
<textarea id="order" rows="40" cols="200">
</textarea>
<br>
</form>
</center>
</div>    
</body>
<style>
    body {
    background-color: #8493f4;
}
h1 {
    font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
}
    </style>
</html>



Aucun commentaire:

Enregistrer un commentaire