+ 3
alert box
is there a way to change the message displayed by alert box?
5 Réponses
0
sure there is,,, just change the content inside the parentheses if the alert box
+ 3
maybe you can try this on your editor -->>
=====HTML:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<button id="one" onclick="hi();">Hi, Welcome</button>
<button id="two" onclick="bye();">Goodbye</button>
</body>
</html>
=====CSS:
button {
outline: none;
border: none;
padding: 5px;
cursor: pointer;
border-radius: 5px;
}
button:active {
transform: translateY(3px);
}
#one {
background: green;
}
#two {
background: red;
}
=====JS:
function hi() {
var hiBtn = document.getElementById("one");
hiBtn.onclick = function() {
alert("Welcome");
}
}
function bye() {
var byeBtn = document.getElementById("two");
byeBtn.onclick = function() {
alert("Goodbye!");
}
}
Hope this will answer your question :)
+ 1
alert("hello Muiruri")....try alerting some texts in ur text editor
0
mack ti
- 1
alert("Some text!"). did you mean like you want to change the message display in the alert box?