CSS 文本框 怎么设置只读?

html-css08

CSS 文本框 怎么设置只读?,第1张

<input name="" type="text" disabled="disabled" readonly="true" />

readonly="true"是设为只读

disabled="disabled"是设为禁用

如果你用的是Dreamweaver做的话,那么插入文本框的时候会有“只读”“禁用”的选项,当然你也可以在浏览模式中点文本框右键进入编辑状态,也可以选择为只读和禁用

如果是文本内容的话,把这一段加在body里就可以了,不用css设置,就像下面那样,这样用户就不可以鼠标右键复制或者ctrl+c

<body leftmargin=0 topmargin=0 oncontextmenu='return false' ondragstart='return false' onselectstart ='return false' onselect='document.selection.empty()'oncopy="return false" oncut="return false" onbeforecopy='return false' onmouseup='document.selection.empty()'>