|
 |
|
Dev Articles Community Forums
> Programming
> JavaScript Development
|
How get selected value in inlineiframe
Discuss How get selected value in inlineiframe in the JavaScript Development forum on Dev Articles. How get selected value in inlineiframe JavaScript Development forum discussing the use of JavaScript and its features as a powerful DOM manipulator. JavaScript is used in most websites to enrich the interface and enhance the user experience.
|
|
 |
|
|
|
|

Dev Articles Community Forums Sponsor:
|
|
|

April 12th, 2010, 09:51 AM
|
|
Registered User
|
|
Join Date: Apr 2010
Posts: 9
Time spent in forums: 2 h 45 m 21 sec
Reputation Power: 0
|
|
How get selected value in inlineiframe
hello
i want create a html editor for a commerical purpose,
how can i get selected value in inlineiframe with javascript?
please help me,i'm waitng......
Last edited by habibvjj : April 12th, 2010 at 09:52 AM.
Reason: none
|

April 12th, 2010, 03:07 PM
|
|
anonymous
|
|
Join Date: Aug 2006
Posts: 244

Time spent in forums: 1 Week 12 h 14 m 42 sec
Reputation Power: 7
|
|
|
Re-invent the wheel?
One good example for this kind of editor is here
Or you may dig some more and find others
all the best 
Last edited by mecanicu : April 12th, 2010 at 03:35 PM.
Reason: This title is a must
|

April 13th, 2010, 11:40 PM
|
|
Registered User
|
|
Join Date: Apr 2010
Posts: 9
Time spent in forums: 2 h 45 m 21 sec
Reputation Power: 0
|
|
|
thanks,
Please tell me solvotion
|

April 14th, 2010, 01:02 PM
|
|
anonymous
|
|
Join Date: Aug 2006
Posts: 244

Time spent in forums: 1 Week 12 h 14 m 42 sec
Reputation Power: 7
|
|
|
Commercial purpose... hmmm
This time I have done the dig and testing for you
Next one do it yourself
here is a sample with 2 files
1. test.html:
Code:
<html>
<head>
<script type="text/javascript">
function getIframeSelectionText(iframe)
{
var win = iframe.contentWindow;
var doc = win.document;
if (win.getSelection)
{
return win.getSelection().toString();
} else if (doc.selection && doc.selection.createRange)
{
return doc.selection.createRange().text;
}
}
function smth()
{
var iframe = document.getElementById("htmlEditor");
alert(getIframeSelectionText(iframe));
}
</script>
</head>
<body>
<iframe src="text.html" id="htmlEditor" width="300" height="200">
</iframe>
<a href="#" onclick="smth();">AA</a>
</body>
</html>
which is referring the file
2. text.html:
Code:
<html>
<body>
Some text sample</br>
Look out!!
</body>
</html>
this sample is based on the code from here
Working OK on Internet Explorer, Firefox, Google Chrome and Opera
all the best 
|

June 4th, 2010, 11:03 AM
|
|
Registered User
|
|
Join Date: Apr 2010
Posts: 9
Time spent in forums: 2 h 45 m 21 sec
Reputation Power: 0
|
|
|
i have problem ,yet
thank you very much my dear friends especially ( mecanicu );
i had used this useful code but i have several problem ,yet.
at the first excuse me , i hope it dont causes your tiredness and you also help me ;
i use this code to get selected value in inlineframe but i have several problem :
for example user click on bold bottom .how i can replace the value that became bold with selected value to become bold by user, i use this cammand but it would not work successfully
Code:
doc.selection.createRange().text = "<b>"+doc.selection.createRange().text+"</b>"
// problem
i am => <b> i am </b>
and dont show bold in inline frame
alse
Code:
win.document.body.innerHTML.replace(doc.selection. createRange().text,"<b>"+doc.selection.createRange().text+"</b>")
// occure error if exist same words in text
2) how i can get corsur (mouse) position in ifame to inserting picture :
soppuse user want insert an image between text in this condition how i can corsur (mouse) position.
i am waiting ....
thank you very much for your help. 
Last edited by habibvjj : June 4th, 2010 at 11:10 AM.
Reason: nothing
|

June 7th, 2010, 11:28 AM
|
|
anonymous
|
|
Join Date: Aug 2006
Posts: 244

Time spent in forums: 1 Week 12 h 14 m 42 sec
Reputation Power: 7
|
|
|
I said this once
You can use an LGPL (GNU Lesser General Public License) html editor
I personally used TinyMCE, with some modifications, for commercial purpose and with the agreement of the client.
We are not supposed to reinvent the wheel
all the best
|

June 8th, 2010, 06:08 AM
|
|
Registered User
|
|
Join Date: Apr 2010
Posts: 9
Time spent in forums: 2 h 45 m 21 sec
Reputation Power: 0
|
|
ok
the editor 95% compeleted ,now you say desert it and use another editor !!! i have just a problem that i say it in above ,please help me this editor include private services for my project and i try very much to make it,
i can create it bbcode-based but i want it be live;
please help me i will mention to your name in this project,thanks
i'm wating to your help ,yet..... 
|

June 8th, 2010, 12:41 PM
|
|
anonymous
|
|
Join Date: Aug 2006
Posts: 244

Time spent in forums: 1 Week 12 h 14 m 42 sec
Reputation Power: 7
|
|
I have told you that twice and at the proper moment here and here in this thread
My comment on my name (anonymous) is what I think about being mentioned in youre (or anyones) source code
Good luck with your last 5% 
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|