document.selection可以得到选中的文本区,创建一个textrange对象,然后可以对其操作关于日期的常见操作
http://community.csdn.net//Expert/TopicView2.asp?id=4360247&datebasetype=now
js FAQ贴
http://community.csdn.net//Expert/TopicView2.asp?id=4356360&datebasetype=now
DHTML手册,js手册,dom手册下载
http://community.csdn.net//Expert/TopicView2.asp?id=4356325&datebasetype=now

解决方案 »

  1.   

    function getSel()
    {
    var txt = '';
    var foundIn = '';
    if (window.getSelection)
    {
    txt = window.getSelection();
    foundIn = 'window.getSelection()';
    }
    else if (document.getSelection)
    {
    txt = document.getSelection();
    foundIn = 'document.getSelection()';
    }
    else if (document.selection)
    {
    txt = document.selection.createRange().text;
    foundIn = 'document.selection.createRange()';
    }
    else return;
    document.forms[0].selectedtext.value = 'Found in: ' + foundIn + '\n' + txt;
    }