Jump to content

javascript frames help


MDanz

Recommended Posts

this is a get selected text function.  It pastes into a textarea. This function works with a normal page(no frames... but with 2 frames it doesn't.

it only works with the bottom frame.. when i want it to get selected text from the top frame. 

 

<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.

Link to comment
https://forums.phpfreaks.com/topic/177854-javascript-frames-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.