DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> JavaScript綜合知識 >> Javascript selection的兼容性寫法
Javascript selection的兼容性寫法
編輯:JavaScript綜合知識     

 本文為大家講解下Javascript selection的兼容性寫法,感興趣的朋友可以參考下

 代碼如下: function getSelectedText() { //this function code is borrowed from: http://www.codetoad.com/javascript_get_selected_text.asp    var txt = "";  if (window.getSelection) {  txt = window.getSelection();  } else if (window.document.getSelection) {  txt = window.document.getSelection();  } else if (window.document.selection) {  txt = window.document.selection.createRange().text;  }  return txt;  }     
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved