刷新页面后自动向下滚动文本区域

时间:2014-12-25 09:44:50

标签: php html

我有一个显示程序日志的脚本,我试图添加header("refresh: 5;url=wget_log.php#bottomOfPage");但它仍然不会向下滚动到textarea的底部。这是我的剧本:

<?php
header("refresh: 5;url=wget_log.php#bottomOfPage");
include 'theme.php';
ceklogin();
css();
echo " Wget log :<br>";
echo "<textarea name=\"bottomOfPage\" rows=\"30\" cols=\"90\" readonly style=\"font-family: Arial;font-size: 7pt;\" >";
$datalines = file ("wget.log");
foreach ($datalines as $zz) {
echo $zz; }
echo "</textarea></div>";
foot();
echo '

</div>
</body>
</div>
</html>';
?>

这是网页的样子,对不起,我仍然不允许直接在stackoverflow上显示图片,所以我只是给你链接到图片:http://s22.postimg.org/cgap9i8kh/image.jpg < / p>

@ Magictallguy 我修改了我的脚本:

<?php
header("refresh: 5;url=wget_log.php#bottomOfPage");
include 'theme.php';
ceklogin();
css();
echo " Wget log :<br>";
echo "<textarea name=\"text-info\" rows=\"30\" cols=\"90\" readonly style=\"font-family: Arial;font-size: 7pt;\" >";
$datalines = file ("wget.log");
foreach ($datalines as $zz) {
echo $zz; }
echo "<span id=\"bottomOfPage\">&nbsp;</span>"
echo "</textarea></div>";
foot();
echo '

</div>
</body>
</div>
</html>';
?>

但它仍然不会向下滚动。

1 个答案:

答案 0 :(得分:0)

您需要在页面底部的某处添加id="bottomOfPage"

或者更确切地说,在<span id='bottomOfPage'>&nbsp;</span>代码

之前添加</textarea>