不可选择的文字 [英] Non-selectable text

查看:53
本文介绍了不可选择的文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!


我正在教授编程,并使用行号显示代码片段

以便于参考。


如果可能,我想让这些行号不可选,所以

如果学生从浏览器复制我的代码,他们不需要

手动剥离行号以使代码正常工作。


css是否有这种效果的风格?


谢谢


Michael

Hello!

I am teaching programming, and display code snippets with line numbers
for easy reference.

If possible, I would like to make these line numbers non-sselectable, so
that if students copy my code from the browser, they do not need to
manually strip the line numbers to make the code work.

Does css have a style to this effect?

Thanks

Michael

推荐答案

michaelp schrieb:
michaelp schrieb:

你好!


我正在教授编程,并用行号显示代码片段

以便于参考。


如果可能的话,我想让这些行号不可选,所以

如果学生从浏览器复制我的代码,他们不需要手动支付
剥离行号以使代码工作。


css是否有st你觉得这个效果怎么样?
Hello!

I am teaching programming, and display code snippets with line numbers
for easy reference.

If possible, I would like to make these line numbers non-sselectable, so
that if students copy my code from the browser, they do not need to
manually strip the line numbers to make the code work.

Does css have a style to this effect?



编号即使它有 - 那些像lynx这样忽略CSS的浏览器呢?

No. And even if it had - what about browsers like lynx which ignore CSS?


michaelp写道:
michaelp wrote:

你好!


我正在教编程,并显示行号
以方便参考。


如果可能,我想让这些行号不可选,所以

如果学生复制我的代码来自浏览器,他们不需要手动剥离行号以使代码工作。


css是否具有这种效果的风格?
Hello!

I am teaching programming, and display code snippets with line numbers
for easy reference.

If possible, I would like to make these line numbers non-sselectable, so
that if students copy my code from the browser, they do not need to
manually strip the line numbers to make the code work.

Does css have a style to this effect?



No.


但如果使用有序列表(OL),则无需输入行显示

数字,IE和Firefox至少不包括所选文本中的

数字。

No.

But if you use an ordered list (OL), you don''t have to enter the line
numbers explicitly, and IE and Firefox, at least, don''t include the
numbers in selected text.

2006年8月11日,michaelp< mi ****** @ hio.nowrote:
On 11 Aug 2006, michaelp <mi******@hio.nowrote:

我正在教授编程,并显示代码片段线路

数字,方便参考。


如果可能的话,我想把这些行号设为

不可选,所以如果学生从

浏览器复制我的代码,他们不需要手动剥离行号来

使代码有效。


css有这种风格吗?
I am teaching programming, and display code snippets with line
numbers for easy reference.

If possible, I would like to make these line numbers
non-sselectable, so that if students copy my code from the
browser, they do not need to manually strip the line numbers to
make the code work.

Does css have a style to this effect?



作为一名程序员,我很感激你的想法,无论是提供

数字还是为了让你的学生能够找到方法削减

并粘贴没有行号的代码。我认为你认为

提供了剪切和粘贴友好的功能。每个页面的版本,例如

"打印机友好的"你经常看到的版本?如果你把代码只是

作为文本存储并插入行号与某种服务器端

处理(php?),那不应该太繁琐,只是一个额外的链接

到源文本文件。


您可能已经知道浏览器如何选择文本(如果有)
$ b从浏览器到浏览器,$ b可能会有所不同?那就说,你怎么插入行号?
?如内联文字所示:


< pre>

1 int main(int argc,char ** argv)

2 {

....

< / pre>


在这种情况下,我不知道你是怎么做的可以避免使用

文本选择数字,除非浏览器支持列选择,这不是我b
意识到的。 (我的编程编辑器确实如此,我非常感谢
感激不尽!)但是,如果行号在一个单独的div中,那么怎么样?

漂浮在左边包含代码的div。我打赌你学生可能会使用的大多数图形浏览器会选择

代码,而不包括行号,因为他们在不同的

div。不过我还没试过。只是一个想法。


Dave


-

David Tiktin

tiktin [at] advancedrelay [dot] com

As a programmer, I appreciate your thought, both in providing line
numbers and for looking for a way for you students to be able to cut
and paste the code without line numbers. I presume you thought of
providing a "cut and paste friendly" version of each page, like the
"printer friendly" versions you often see? If you store the code just
as text and insert line numbers with some kind of server side
processing (php?), that shouldn''t be too onerous, just an extra link
to the source text file.

You probably already know that how a browser selects text (if it does)
could well vary from browser to browser? That said, how are you
inserting the line numbers? As inline text like:

<pre>
1 int main(int argc, char ** argv)
2 {
....
</pre>

In that case, I don''t see how you can avoid selecting the numbers with
the text unless the browser supports column selection, which none I''m
aware of do. (My programming editor does, for which I''m very
grateful!) But what if the line numbers were in a separate div,
floated to the left of the div containing the code. I''ll bet most
graphical browsers your students are likely to use would select the
code without including the line numbers since they''re in a different
div. I haven''t tried it, though. Just a thought.

Dave

--
D.a.v.i.d T.i.k.t.i.n
t.i.k.t.i.n [at] a.d.v.a.n.c.e.d.r.e.l.a.y [dot] c.o.m


这篇关于不可选择的文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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