Strange position of the page after loading it
Why is it that every time when I load my site it is not opening as every page, but in the middle, so I have to scroll up to s开发者_JAVA技巧ee top of this page.
I know it's because Ajax-based chatbox, but I cannot spot where it's wrong.
JavaScript is included at the bottom of the page, before </body>
.
Any ideas?
Line 120 of the script output by chat.php has this line:
message.focus();
Which is giving focus to the <input id="message" type="text" size="25" maxlength="80" onkeyup="keyup(event);">
text input. That's what's jumping your page down.
It jumps down to that point and then loads the chat messages.
Your index2.html has loads of <br>
tags; which is the spacing gap you see.
<html>
<head>
<link rel="stylesheet" href="/style.css" type="text/css">
</head>
<body>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br>
<div id="chatramka">
<div style="text-align:center;margin:3px;">Shoutbox</div>
<div id="chat">Åadowanie shoutboxa...</div>
<div style="overflow:auto;"><input id="message" type="text" size="25" maxlength="80" onkeyup="keyup(event);">
<input id="chatbtn" type="button" value="wyślij" onclick="chat_write();" style="cursor:pointer;border:1px solid gray;"></div>
</div>
<script language="JavaScript" type="text/javascript" src="chat.php"></script>
</body>
</html>
精彩评论