• Thống kê diễn đàn


Code thêm 1 trích dẫn không chuyển trang bằng js đơn giản

View previous topic View next topic Go down

Code thêm 1 trích dẫn không chuyển trang bằng js đơn giản Empty Code thêm 1 trích dẫn không chuyển trang bằng js đơn giản

Post by kjucxanh_95 8/3/2013, 8:35 pm

Tạo 1 js đặt In the topics.

Code:

            $(function () {
                $('.i_icon_quote', document.getElementById('main-content')).click(function (e) {
                    e.preventDefault();
                    var selection = (function () {
                        if(window.getSelection) {
                            var e = document.activeElement;
                            if(e && e.tagName.toLowerCase() in {
                                textarea: 1,
                                input: 1
                            }) {
                                return e.value.substring(e.selectionStart, e.selectionEnd)
                            } else {
                                return window.getSelection().toString()
                            }
                        } else if(document.selection.createRange) {
                            return(document.selection.createRange()).text || ''
                        }
                        return null
                    })();
                    if(selection) return bbfontstyle('[quote]' + selection + '[/quote]', '');
                    var x = $('body').append('<div id="ifquote" style="display:none"></div>').find('#ifquote');
                    x.load(this.parentNode.href + ' textarea', function () {
                        bbfontstyle(x[0].getElementsByTagName('textarea')[0].value, '');
                        x.remove()
                    })
                })
 
kjucxanh_95
kjucxanh_95
Quản Trị Viên
Quản Trị Viên

Posts : 383
Points : 295526
Thanked : 63
Birthday : 1995-09-20
Status Mãi Mãi Yêu Mình Anh
Giới tính : Female Đừng ghẹo nha

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum