|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Identify frames
this only works with 1 page(no frames) when i make 2 frames it doesn't work.
Code:
<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>
document.getSelection(); and window.getSelection() only work for the frame the code is in. how do i change these getSelection(); for the specific frame? the top frame is link.php and the bottom is menu.php Code:
<FRAMESET ROWS="73%,*" cols="*" >
<FRAME SRC="link.php" name="link_frame">
<FRAME SRC="menu.php" name="menu_frame">
</FRAMESET>
Code:
<form name=aform >
<textarea name="selectedtext" cols="50" rows="4"></textarea>
<input name="button" type="button" onmousedown="getSelText()" value="Get selection" target="link_frame"/>
</form>
i want to get selected text from link.php and paste in the textarea in menu.php.. i tried changing to this but no success parent.link_frame.getSelection |
|
#2
|
|||
|
|||
|
tried this but no working, it should get selected text from the top frame.
Code:
<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>
|
|
#3
|
|||
|
|||
|
I thought you already posted this in the PHP forum...is that not working? Why would you want to use javascript instead of PHP to redirect?
__________________
Sir, a desire of knowledge is the natural feeling of mankind; and every human being, whose mind is not debauched, will be willing to give all that he has to get knowledge. |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Client Side Things > Identify frames |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|