Как именно?
html{
--footer-height : 50px; /* высота футера*/
}
body{
position:relative;
padding-bottom: var( --footer-height );
}
footer{
position: absolute;
bottom: 0;
min-height: var( --footer-height );
}
<?php
if (isset($_POST['doIt']))
{
...... изменение слова
}else{
......изначальное слово
}
Возник вопрос возможно ли избежать вложенного цикла в данной задачи и как это можно сделать?
const table = document.createElement('table'),header = ["id","name", "address"],
message = [header, // <-- первый элемент
{id:1, name:"two_1", address:"add_1"},
{id:2, name:"two_2", address:"add_2"},
{id:3, name:"two_3", address:"add_3"},
{id:4, name:"two_4", address:"add_4"},
{id:5, name:"two_5", address:"add_5"},
{id:6, name:"two_6", address:"add_6"}
];
table.innerHTML =
message.map((m, i)=>`<tr>${header.map((h,j)=>(j=i?'td':'th',l=i?m[h]:h,`<${j}>${l}</${j}>`)).join('')}</tr>`).join('');
document.querySelector('body').appendChild(table); // <-- выводим таблицу ))
Заголовки таблицы являются ключи первого элемента message[0]
БЫСТРО получить ответ на вопрос по фронтенду и веб-разработке
Object.prototype.keys = function(){
return Object.keys(this);
}
Object.prototype.keysToString = function(){
return Object.keys(this).join(' ');
}
const obj = {
one: true,
two: true
}
console.log(obj.keys());
console.log(obj.keysToString());
for(let handler of handlers) {
console.log(handler); // <--- this
if (handler.length == 0) {
if (isYes) {
handler() }
} else {
handler(isYes);
}
}
<?php if(!isset($_REQUEST['width'])){ ?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=5.0, user-scalable=yes">
</head>
<body>
<script>
location.replace(location.protocol+'//'+location.host + location.pathname +'?width=' + document.body.offsetWidth);
</script>
</body>
</html>
<?php }else{
$width = intval($_REQUEST['width']);
?>
<!DOCTYPE html>
<html>
<head>
<title><?php echo $width >= 769 ? 'desktop' : 'mobile';?></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=5.0, user-scalable=yes">
<style>
html{}
body{
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
}
.desktop{color:green;}
.mobile{color:red;}
</style>
</head>
<body>
<h1 class="<?php echo $width >= 769 ? 'desktop' : 'mobile';?>">
<?php echo $width >= 769 ? 'desktop' : 'mobile';?>
</h1>
</body>
</html>
<?php }?>