创造一个“尾巴”像textarea? [英] creating a "tail" like textarea ?

查看:68
本文介绍了创造一个“尾巴”像textarea?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个像tail这样的unix。功能在我的网站上。


问题:

文本显示在滚动区域,并在
$ b添加新行$ b end和整个文本向下滚动,以便用户可以看到最后一项

添加。


i我试图避免显示HTML文件并且有向下滚动,

因为它似乎不能一直工作


任何指针都非常赞赏

解决方案

在文章< 42 ******** @ usenet01.boi.hp.com>中,我********** @ hp.com 开明

我们......

我需要创建一个类似tail的unix。功能在我的网站上。

问题:
文本显示在滚动区域,并在
末尾添加一个新行,整个文本向下滚动,以便用户可以看到最后一项
已添加。




是否有用户无法找到结束键的原因?

结束到底。

首页回到顶部。

键通常位于键盘的中间部分,位于

箭头。


如果您的应用程序不支持End和Home,您可能需要考虑

修复它。它比编码JS滚动更容易。 ;)


-

-

~kaeli~

很多钱都是受污染 - 它污染了你的污点并使它变得污秽。
http://www.ipwebdesign。 net / wildAtHeart
http://www.ipwebdesign.net/kaelisSpace


用户想要查看最后一行,并且每次

行都不需要翻页插入!!!


" kaeli" < TI ****** @ NOSPAM.comcast.net>在留言中写道

新闻:MP *********************** @ nntp.lucent.com ...

在文章< 42 ******** @ usenet01.boi.hp.com>中,我********** @ hp.com
启发我们...

我需要创建一个像tail这样的unix。功能在我的网站上。

问题:
文本显示在滚动区域,并在
末尾添加一个新行,整个文本向下滚动,以便用户可以看到最后添加的
项目。
用户是否找不到结束键?

结束到底。
首页顶部。
键通常位于键盘的中间部分,上面是



箭头。

如果您的应用程序没有不支持End和Home,你可能要考虑修复它。它比编码JS滚动更容易。 ;)

-
-
〜凯莉〜
很多钱都被污染了 - 它会污染你的,它会污染我的。
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace



Mel写道:

我需要创建一个像tail这样的unix。功能在我的网站上。

问题:
文本显示在滚动区域,并在
末尾添加一个新行,整个文本向下滚动,以便用户可以看到最后一项
已添加。



[..]


以下是基本的,它添加了新行顶部

而不是底部(这对大多数用户更有意义),

并显示固定数量的条目,因此底线为

修剪掉了。


如果你想把它添加到底部,那也可以通过

删除第一个元素然后添加新元素结束。

< script type =" text / javascript">

//如果需要更长的尾巴,请添加更多元素

var tail = new Array(10);

函数tailIt(x,y){

tail.unshift(x);

tail .pop();

document.getElementById(y).innerHTML = tail.join(''< br>'');

}

< / script>

< form action ="">

< table border =" 1">< tr> < td>

< input type =" text"大小= QUOT; 30英寸; name =" inText">

< / td>< td>

< input type =" button" value =" Add to tail" onclick ="

tailIt(this.form.inText.value,''outputCell'');">

< / td>< td id = QUOT; outputCell" style =" width:20em;">

< script type =" text / javascript">

document.write(tail.join(' '< br>''));

< / script>

< / td>

< / tr>

< / table>

< / form>

-

Rob


i need to create a unix like "tail" function on my site.

the question:
the text is displayed in a scrolled area and a new line is added at the
end and the entire text is scrolled down so that user can see the last item
added.

i am trying to avoid displaying an HTML file and have to scroll it down,
since it does not seem to work all the time

any pointer is highly appreciated

解决方案

In article <42********@usenet01.boi.hp.com>, me**********@hp.com enlightened
us with...

i need to create a unix like "tail" function on my site.

the question:
the text is displayed in a scrolled area and a new line is added at the
end and the entire text is scrolled down so that user can see the last item
added.



Is there a reason the user can''t find the End key?

End goes to the bottom.
Home goes to the top.
The keys are usually sitting in the middle section of the keyboard, above the
arrows.

If your application doesn''t support End and Home, you may want to consider
fixing that. It''s easier than coding JS scrolling. ;)

--
--
~kaeli~
A lot of money is tainted - It taint yours and it taint mine.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace


user want to see the last line and does not have to page down every time a
line is inserted !!!

"kaeli" <ti******@NOSPAM.comcast.net> wrote in message
news:MP***********************@nntp.lucent.com...

In article <42********@usenet01.boi.hp.com>, me**********@hp.com enlightened us with...

i need to create a unix like "tail" function on my site.

the question:
the text is displayed in a scrolled area and a new line is added at the end and the entire text is scrolled down so that user can see the last item added.
Is there a reason the user can''t find the End key?

End goes to the bottom.
Home goes to the top.
The keys are usually sitting in the middle section of the keyboard, above


the arrows.

If your application doesn''t support End and Home, you may want to consider
fixing that. It''s easier than coding JS scrolling. ;)

--
--
~kaeli~
A lot of money is tainted - It taint yours and it taint mine.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace



Mel wrote:

i need to create a unix like "tail" function on my site.

the question:
the text is displayed in a scrolled area and a new line is added at the
end and the entire text is scrolled down so that user can see the last item
added.


[..]

The following is rudimentary, it adds new lines to the top
rather than the bottom (which makes more sense to most users),
and displays a fixed number of entries so the bottom lines are
trimmed off.

If you want it to add to the bottom, that is possible too by
deleting the first element then adding the new one to the end.
<script type="text/javascript">
// Add more elements if a longer tail is required
var tail = new Array(10);
function tailIt(x,y){
tail.unshift(x);
tail.pop();
document.getElementById(y).innerHTML = tail.join(''<br>'');
}
</script>
<form action="">
<table border="1"><tr><td>
<input type="text" size="30" name="inText">
</td><td>
<input type="button" value="Add to tail" onclick="
tailIt(this.form.inText.value,''outputCell'');">
</td><td id="outputCell" style="width: 20em;">
<script type="text/javascript">
document.write(tail.join(''<br>''));
</script>
</td>
</tr>
</table>
</form>
--
Rob


这篇关于创造一个“尾巴”像textarea?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆