簡體   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