Thứ Tư, 10 tháng 2, 2016

Copy những nội dung nhất định trong bài blogger


Cách 1: Vào Template (Mẫu), click vào Edit HTML (Chỉnh sửa HTML)
<script type='text/javascript'>
 if (typeof document.onselectstart!=&quot;undefined&quot;) {
 document.onselectstart=new Function (&quot;return false&quot;);
}
 else{
 document.onmousedown=new Function (&quot;return false&quot;);
 document.onmouseup=new Function (&quot;return true&quot;);
}
</script>  

Cách 2 sử dụng mã CSS
1. Đăng nhập và vào bố cục
2. Chọn mẫu (template) => chỉnh sửa HTML (Edit HTML)
3. Chèn đoạn code bên dưới vào trước thẻ ]]></b:skin>
<!--Disable Highlighting-->
<style type='text/css'>
.post{
-webkit-user-select: none; /* Webkit */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE 10 */
/* Currently not supported in Opera but will be soon */
-o-user-select: none;
user-select: none;
}
pre,code{
-webkit-user-select: text; /* Webkit */
-moz-user-select: text; /* Firefox */
-ms-user-select: text; /* IE 10 */
/* Currently not supported in Opera but will be soon */
-o-user-select: text;
user-select: text;
}
</style>
4. Lưu mẫu của bạn lại là xong và kiểm tra kết quả nha.

Cách cho phép độc giả copy một đoạn duy nhất trong bài viết của bạn.

Đoạn code trên sẽ khiến toàn bộ bài viết của bạn bị vô hiệu hoá click chuột phải và quét khối, giờ muốn cho độc giả quét khối khu vực nào bạn chỉ cần sử dụng đoạn mã bên dưới trong HTML của bài viết.
<pre>
Đoạn code được phép copy
</pre>
hoặc đoạn code sau:
<code>
Đoạn code được phép copy
</code>

0 nhận xét:

Đăng nhận xét