<html>
<head>
</head>
<body>
<input type="text" id="inputtext" value="цветной текст"><br>
<input type="button" onclick="buttton_clicked()" value="цветной текст"><br>
<script>
var n = 0;
function buttton_clicked()
{
var elem_1 = document.getElementById("inputtext");
for (var i = 0; i < elem_1.value.length; i++){
add_symbol(elem_1.value.charAt(i));
}
}
function add_symbol(symbol)
{
var element = document.createElement("div");
document.body.appendChild(element);
element.innerHTML = symbol;
element.style.position = "absolute";
element.style.top = "150";
element.style.left = n;
element.style.fontSize = 25;
element.style.color = "rgb(" + Math.floor((Math.random() * 256)) + "," +Math.floor((Math.random() * 256))+"," + Math.floor((Math.random() * 256)) +")";
n = n + 25;
}
</script>
</body>
</html>
|