473,473 Members | 1,723 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Can you get selected text from a parent?

If I have an iFrame on a webpage, and a user selects text or objects in the
parent of my iFrame, how can I get the selected text or objects properties
from my iFrame child?
Oct 6 '06 #1
2 1987


smerf wrote:
If I have an iFrame on a webpage, and a user selects text or objects in the
parent of my iFrame, how can I get the selected text or objects properties
from my iFrame child?
In general how the browser exposes a text selection to script is highly
browser dependent.
Mozilla and by now Opera 9 expose a selection object per window that you
can access as
if (typeof window.getSelection != 'undefined') {
var selection = window.getSelection();
}
respective for the iframe then
if (window != parent && typeof parent.getSelection != 'undefined') {
var selection = parent.getSelection();
}
One documentation for that selection object is here:
<http://www.xulplanet.com/references/objref/Selection.html>


--

Martin Honnen
http://JavaScript.FAQTs.com/
Oct 6 '06 #2
Sweet! Thanks for the help, Martin.

"Martin Honnen" <ma*******@yahoo.dewrote in message
news:45***********************@newsspool1.arcor-online.net...
>

smerf wrote:
>If I have an iFrame on a webpage, and a user selects text or objects in
the parent of my iFrame, how can I get the selected text or objects
properties from my iFrame child?

In general how the browser exposes a text selection to script is highly
browser dependent.
Mozilla and by now Opera 9 expose a selection object per window that you
can access as
if (typeof window.getSelection != 'undefined') {
var selection = window.getSelection();
}
respective for the iframe then
if (window != parent && typeof parent.getSelection != 'undefined') {
var selection = parent.getSelection();
}
One documentation for that selection object is here:
<http://www.xulplanet.com/references/objref/Selection.html>


--

Martin Honnen
http://JavaScript.FAQTs.com/

Oct 6 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Filiz Duman | last post by:
Hi, I am opening a pop up window (child) from a parent window. The Child window does show a table with multiple columns and rows, each showing a value, e.g. 9 or 10 or etc. I have the values as...
2
by: worzel | last post by:
Can't suss this out for the life of me, googling of no help either. Okay, new to win forms; I have a treeview with several root nodes, each having a single level of child nodes underneath. I also...
1
by: Sam | last post by:
hi i'm trying to get the value of the selected node in my treeview. my code is: txtTable1.Text = tvRelations.SelectedNode.Parent.ToString but it adds the string 'TreeNode: ' to the value of...
1
by: jobs | last post by:
Given the Gridview below: When I select the button "Rate" and fall into this code. How can I reference "carriercode" and others . Apparently selecting the button does not select the row. I've...
4
by: Ted Ngo | last post by:
Hi All, I am using treeview control in asp.net 2.0. this is my treeview: ZZZZZ NNNNNN HHHHHHH KKKKKKK AAAA
2
by: jojoba | last post by:
hi welcome to cross domain fun! i am serving an asp page. i have an iframe in the page pointing to another domain, say, http://www.google.com. ok, i know, different domains. i know i can...
1
by: sdshah5 | last post by:
hi, i want to know how to pass selected value from dropdownlist of child page to a multiline textbox on the parent page. in my code it is giving me the "id" of the selected dropdown value in the...
1
by: Falcula | last post by:
Hello, I have a treeview control, when i select a item i navigate to url. But selected node is lost, it reset itself, loosing state. I post my code here. Thanks in advance. <script...
0
by: Dave Mathew | last post by:
I'm in the process of building some navigation for a website. I would like to use the capabilities of the sitemap in asp.net but have ran into some styling/usability issues in the past using just...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.