JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 12th, 2010, 09:51 AM
habibvjj habibvjj is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2010
Posts: 9 habibvjj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 21 sec
Reputation Power: 0
Red face 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

Reply With Quote
  #2  
Old April 12th, 2010, 03:07 PM
mecanicu mecanicu is offline
anonymous
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Posts: 244 mecanicu User rank is Private First Class (20 - 50 Reputation Level)mecanicu User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 12 h 19 m 50 sec
Reputation Power: 8
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

Reply With Quote
  #3  
Old April 13th, 2010, 11:40 PM
habibvjj habibvjj is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2010
Posts: 9 habibvjj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 21 sec
Reputation Power: 0
thanks,
Please tell me solvotion

Reply With Quote
  #4  
Old April 14th, 2010, 01:02 PM
mecanicu mecanicu is offline
anonymous
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Posts: 244 mecanicu User rank is Private First Class (20 - 50 Reputation Level)mecanicu User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 12 h 19 m 50 sec
Reputation Power: 8
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

Reply With Quote
  #5  
Old June 4th, 2010, 11:03 AM
habibvjj habibvjj is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2010
Posts: 9 habibvjj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #6  
Old June 7th, 2010, 11:28 AM
mecanicu mecanicu is offline
anonymous
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Posts: 244 mecanicu User rank is Private First Class (20 - 50 Reputation Level)mecanicu User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 12 h 19 m 50 sec
Reputation Power: 8
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

Reply With Quote
  #7  
Old June 8th, 2010, 06:08 AM
habibvjj habibvjj is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2010
Posts: 9 habibvjj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.....

Reply With Quote
  #8  
Old June 8th, 2010, 12:41 PM
mecanicu mecanicu is offline
anonymous
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Posts: 244 mecanicu User rank is Private First Class (20 - 50 Reputation Level)mecanicu User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 12 h 19 m 50 sec
Reputation Power: 8
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%

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > How get selected value in inlineiframe


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap