-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfancifymytext.js
46 lines (38 loc) · 1.56 KB
/
fancifymytext.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
function showAlert() {
alert("Font size increased!");
// Get the textarea element by its id
var textarea = document.getElementById("textBox");
// Set the new font size (24 pt)
textarea.style.fontSize = "24pt";
}
function radioButtonAlert() {
var textarea = document.getElementById("textBox");
var fancyRadio = document.getElementById("fancy");
var boringRadio = document.getElementById("boring");
if (fancyRadio.checked) {
textarea.style.fontWeight = "bold";
textarea.style.color = "blue"; // Change text color to blue
textarea.style.textDecoration = "underline"; // Add underline
alert("Bolding, underlining, and blue-ing");
} else if (boringRadio.checked) {
textarea.style.fontWeight = "normal";
textarea.style.color = "black"; // Change text color to black
textarea.style.textDecoration = "none";
alert("No bold, underlining, and blue-ing!");
}
}
function mooButtonChanges() {
alert("Uppercasing and Moo-ing!");
// Get the textarea element by its id
var textarea = document.getElementById("textBox");
// Uppercase the text in textarea
textarea.value = textarea.value.toUpperCase();
// Split the text by periods and join with -Moo
var textValue = textarea.value;
var parts = textValue.split(".");
textValue = parts.join("-Moo");
textarea.value = textValue;
}
// Add an event listener to the "Bigger!" button
document.getElementById("biggerButton").onclick = showAlert;
document.getElementById("mooButton").onclick = mooButtonChanges;