<script language=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>

how do i identify the frames?.. document.getSelection(); and window.getSelection() only work for the frame the code is on. how do i change these getSelection(); for specific frame? i tried copying code to top frame but doesn't work.


i tried changing to this but no success

parent.link_frame.getSelection

i tried changing to this to so it get's selected text from the top frame but still doesn't work.

<script language=javascript>
function getSelText()
{
    var txt = '';
   
     if (parent.link_frame.location.getSelection)
    {
        txt = parent.link_frame.location.getSelection();
             }
    else if (parent.link_frame.location.getSelection) // FireFox
    {
        txt = parent.link_frame.location.getSelection();
            }
    else if (parent.link_frame.location.selection)  // IE 6/7
    {
        txt = parent.link_frame.location.selection.createRange().text;
            }
    else return;
document.aform.selectedtext.value =  txt;
}
</script>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.