Adding Javascript Code

This commit is contained in:
2026-09-23 17:11:32 +02:00
parent 72a94ecde8
commit aa333094e0
3 changed files with 95 additions and 19 deletions
+25
View File
@@ -0,0 +1,25 @@
button {
width: 100%;
padding: 10px;
margin: 8px ;
background-color: darkcyan;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
input{
width: 100%;
}
.webBox{
text-align: center;
}
.boxText{
display:block;
float:left;
padding:5px 10px
}
+36
View File
@@ -0,0 +1,36 @@
function setSize(varWidth, varHeight){
var box = document.getElementById("webBoxSel");
var boxHeight = (varHeight / 2);
var boxwidth = (varWidth / 2);
if(boxHeight >= 300)
{
box.style.backgroundColor = 'red';
}else{
box.style.backgroundColor = 'yellow';
}
box.style.width = boxwidth+'px';
box.style.height = boxHeight+'px';
var textInBox = document.getElementById("boxText");
textInBox.style.color = 'blue';
textInBox.style.margin = '25%';
textInBox.style.marginLeft = '25%';
}
if(document.readyState === "loading"){
const varW = window.outerWidth;
const varH = window.outerHeight;
setSize(varW, varH);
}
window.addEventListener("resize", function (){
const varW = window.outerWidth;
const varH = window.outerHeight;
setSize(varW, varH);
})