<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<p>Размер шрифта</p>
<select id="select" onchange="changeselect()">
</select>
<p style="position:absolute;left:150px;top:0px;">Цвет шрифта</p>
<input id="textcolor" type="color" style="position:relative;left:100px;">
<p><textarea id="usertext">
юзертекст
</textarea></p>
<script>
for (let i = 0 ; i < 250;i++){
let option = document.createElement('option');
option.text = i;
option.value = i;
document.querySelector('#select').add(option);
}
document.querySelector('#select').value = "25";
document.querySelector('#usertext').style.height = "500px";
document.querySelector('#usertext').style.width = "1000px";
textcolor.addEventListener("change",setcolor);
function setcolor(){
let valuecolor = document.querySelector('#textcolor').value;
document.querySelector('#usertext').style.color = valuecolor;
}
function changeselect(){
let select = document.querySelector('#select');
let value = select.options[select.selectedIndex].value;
document.querySelector('#usertext').style.fontSize = value+"px";
}
</script>
</body>
</html>
|