|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
WYSIWYG-editor question - multiple editors
Is it possible to put more
than one editor on a page? I'm not very good at Java, but when I look at the code, it seems to me that when it is possible to pass the id-value over to the functions i.e. doBold(), I could put more than one editor on a page without duplicating the fuctions for each editor. Is this possible and could you explain how? |
|
#2
|
|||
|
|||
|
Rule
It is possible but it is very time consuming work for every editor, you need to make most methods and all variables have unique name. What i recommed is to make the editor dynamically generated using a function which takes in a unique id. That way you don't need to write js and html manually for every editor in the page. or if you are using it in ASP.NET simply invest in our new EditWorks Professional.NET . Its very cheap and has heaps of features!!!
__________________
Regards, James Yang .NET Developer / Network Engineer MCSE, MCDBA, MCSA, CCNA http://www.yellowpin.com/ http://www.opentechsupport.com/ |
|
#3
|
|||
|
|||
|
So it's not as simple to pass the id of the iframe along to the functions as a variable and then adjust the functions so that tey use this variable in stead of the fixed iframe id?
|
|
#4
|
|||
|
|||
|
Yeah that's okay too. I'll say that's a better way of doing it.
![]() But you need to modify the all the functions though... The support file that comes with the article doesn't use that technique. |
|
#5
|
|||
|
|||
|
You will still need a hidden input for each editor though... if you are to use it at the server side.
|
|
#6
|
|||
|
|||
|
My problem is that I don't know how to pass the id to the functions and how to use in in the function.
Could you give me an example? I've tried the following: function doBold(var) { var.document.execCommand('bold', false, null); } ... onClick="doBold('i_View')" ... iframe id="i_View" But that didn't work. I don't know java so this was my best shot. |
|
#7
|
|||
|
|||
|
Im not sure ..how this would be done.. U see im not a js guy at all
!!/ but try using GetElementByID function GetElementByID(iView).document.execCommand ... here is a tutorial link http://getelementbyid.com/tutorials...hod/index.shtml |
|
#8
|
|||
|
|||
|
It seems to me that "document.getElementById" doesn't work with the iframe.
document.getElementById(iview).document.execComman d('bold',false,null); doesn't work, document.getElementById(iview).document.style.visi bility = "hidden"; works fine. |
|
#9
|
|||
|
|||
|
You've got the right idea - just pass the field name with each function call. You could probably alias the variable as an object, but I just used eval() to get it running and preserve a similar syntax in the code. For example, I pass in the WYSIWYG name as 'editPane' in the function and then use something like this:
eval(editPane+'.document.execCommand(\'backcolor\' , false, bCol)'); I've never used that getElementById, so don't worry about that either. It really is easier if you're using something like ASP or PHP (I use CF) to auto-generate the editor and form filed names. I also had to change the visibility toggle on the select dropdowns as a result. |
|
#10
|
|||
|
|||
|
I tried your answer but without success. I get an error that the WYSIWYG name doesn't exist on the line where I put the eval... function. So the name gets passed through but I can't use it there. This is the same result as when I don't use the eval function but put myvariable.document. ... to execute the function. So why does that id not exist there?
|
|
#11
|
|||
|
|||
|
this is a trick mytch told me and worked most of the time when there was id doesn't exist error.
setTimeout("puturcommandhere",1); replace puturcommandhere with ur line of code. i dunno why this works but it works!! ![]() |
|
#12
|
|||
|
|||
|
Nope, didn't work, keeps telling me iview is undefined.
I'm just looking for a way to pass the iframe id to the doBold function. If I have that, all problems are solved. |
|
#13
|
|||
|
|||
|
this might sound dumb
but try putting the js after the iframe.. like near the end of the body tag... probably won't work.. but try.. |
|
#14
|
|||
|
|||
|
No changes, still undefined iview
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > WYSIWYG-editor question - multiple editors |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|