gpt4 book ai didi

javascript - 我将如何定位网页中的所有内容,以便即使浏览器大小或屏幕分辨率发生变化,所有内容仍然存在?

转载 作者:行者123 更新时间:2023-11-28 12:13:33 24 4
gpt4 key购买 nike

我正在使用 Firefox 浏览器和我自己制作的网页制作(为了好玩 :P)锁屏。我所做的是安装一个 R-kiosk 插件以强制 Firefox 全屏启动,将我的网页设为主页,并将其设置为在启动时运行。我的代码在我的笔记本电脑上运行良好,但我遇到了问题。如果浏览器大小或屏幕大小发生变化,那么……嗯……一切都会发生变化。文本框将远离我想要的位置。按钮也放错了地方。到目前为止,这就是我想出的:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>LogIn</title>
<style>
body{margin:0; padding: 0;}
.bg {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: -5000;

}
table {
width: 100%;
border: 0;
margin: 0;
padding: 0;
}

</style>
<script type="text/javascript">
function cia(){
if ((document.getElementById('pass').value == "amethyst")){
document.getElementById('audio').play();
document.login.src="loading.gif";
setTimeout('window.close()',8000);
}
else{
alert('Error! Invalid combination. Please try again.');
location.reload();
}
}

</script>
</head>
<body><div align="center"><img src="img.jpg" class="bg"/></div><form name="formL" id="formL"><table>
<tr><td height="413">&nbsp </td></tr>
<tr>
<td width="49%" height="45">&nbsp;</td>
<td width="51%"><input id= "un" type="text" value="MidGuardiaN"/></td>
</tr>
<tr>
<td width="49%">&nbsp;</td>
<td width="51%"><input id="pass" name="pass" type="password" value="" autofocus="autofocus" onKeydown="Javascript: if (event.keyCode==13)cia();"/></td>
</tr>
</table>
<table>
<tr>
<td width="49%">&nbsp;</td>
<td width="51%"><a href="javascript:;" onClick="cia()" > <img name="login" src="login.png"/></a></td>
</tr>
</table>
</form>
<audio id="audio" src="welcome.mp3" ></audio>
</body>
</html>

希望您能帮助我改进这一点。谢谢。

最佳答案

你需要研究Responsive Web Design .

关于javascript - 我将如何定位网页中的所有内容,以便即使浏览器大小或屏幕分辨率发生变化,所有内容仍然存在?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19341442/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com