clipboard copy #2

by toubia95

HTML

<label for="L1">param1<input type="text" value="Hello World" id="L1" onclick="this.select();document.execCommand('copy');"></label><br>
<label for="L2">param2<input type="text" value="Hello World 2" id="L2" onclick="this.select();document.execCommand('copy');"></label><br>
<div id="display">
</div>
<textarea></textarea>

JavaScript

/*
var copyInput = function(x) {
  var el = document.getElementById(x);
  el.onclick = function() {
    this.select();document.execCommand("copy");
  }
}
copyInput('myInput');
*/

//https://jsfiddle.net/toubia95/mso0Lf7h/?nom=234&prenom=987435HGFSQD

var getUrlParameter = function getUrlParameter(sParam) {
    var sPageURL = window.location.search.substring(1),
        sURLVariables = sPageURL.split('&'),
        sParameterName,
        i;

    for (i = 0; i < sURLVariables.length; i++) {
        sParameterName = sURLVariables[i].split('=');

        if (sParameterName[0] === sParam) {
            return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
        }
    }
};