繁体   English   中英

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

[英]Auto scroll down a textarea after refreshing a page

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

<?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

@ 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>';
?>

但它仍然不会向下滚动。

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

或者,更准确地说,在</textarea>标记之前添加<span id='bottomOfPage'>&nbsp;</span>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM