Test: Javascript Get Selected Text
<script type="text/javascript">
function getSelText()
{
var txt = '';
if (window.getSelection)
{
txt = window.getSelection();
}
else if (document.getSelection) // FireFox
{
txt = document.getSelection();
}
else if (document.selection) // IE 6/7
{
txt = document.selection.createRange().text;
}
else return;
document.aform.selectedtext.value = txt;
}
</script>
<input onmousedown="getSelText()" type="button" value="Get selection" />
<form> <textarea cols="20" rows="5" name="selectedtext"></textarea>
</form>GD Star Rating
loading...
loading...
Tham khảo:
- 25 mẹo SEO khi thiết kế website
- Cách giải nén và chỉnh sửa tham số php trên Vdeck4
- Hướng dẫn ẩn và hiển thị nội dung sau khi đã nhấn like của Facebook
- Thêm nút Pinterest Pin-It vào website của bạn
- 7 điều cần tránh khi làm website thương mại
- Top 10 plugin thống kê tốt nhất cho WordPress
- Hướng dẫn code giống kiểu facebook tag
- Tạo form thanh toán qua paypal trên website
- Paypal là gì ?
- Thêm các biểu tượng social vào WordPress bằng Simple Social Icons
Recent Comments